My application already uses Joda time to process data with plans to upgrade to jsr 310 in the near future.
Now I need to store a VERY exact timestamp in the database using jpa 2 and hibernate, but java.util.Date does not save the millisecond value.
I found UserType and configured my entity like this
@Column( name = "TRANSACTION_TIME" ) @Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime") private DateTime transactionTime;
but it still doesn't save milliseconds.
I went through this 2010-11-02 12:02:54.945 , but when I received it, it was 2010-11-02 12:02:54.000 .
What else do I need to do to save milliseconds and possibly timezone?
UPDATE I just checked, and milliseconds actually fall into the database, but Hibernate does not include it in the returned results. The same formatter printed two results, so the formatting problem cannot be
source share