Laurent
Laurent

Reputation: 1

joda time hibernate to DB2 DATE

I tried without succes to make a custom type mapping between DateTime joda and DATE db2. Which annotations should we use in the case of using joda time hibernate library instead of custom type mapping ? Thanks a lot

Upvotes: 0

Views: 1148

Answers (3)

Chris Pheby
Chris Pheby

Reputation: 11

Please take a look at my project on Sourceforge (Usertype) which supports Joda Time and the JSR 310 drafts. Unlike the Joda Time Contrib library this works with Hibernate 3.6 and it should be very straightforward to use if you are familiar with Joda Time Contrib's Hibernate usertypes.

See http://usertype.sourceforge.net/

Upvotes: 1

Don Roby
Don Roby

Reputation: 41137

There is an open-source library supporting this on sourceforge. Now that I reread your question, you're likely already using it.

This includes a UserType so that you can map Joda DateTime fields with

   @Type(type="org.joda.time.contrib.hibernate.PersistentDateTime")

Upvotes: 2

Sean Patrick Floyd
Sean Patrick Floyd

Reputation: 298978

Why don't you just map plain java dates and convert to / from joda dates when you read / write the values?

Upvotes: 2

Related Questions