Hello,
I am having problems mapping date and time entity attributes with JPA and Oracle 11.
If I give an entity attribute a DATE temporal type, store an instance of the entity in an Oracle 11 database, and retrieve it, I loose the attribute's time part
@Temporal(TemporalType.DATE) private Date myDateAndTime; // eg, 2012-12-31 00:00:00 instead of, say, 2012-12-31 23:59:59
If, on the other hand, I give the attribute a TIME temporal type, I loose the attribute's date part
@Temporal(TemporalType.TIME) private Date myDateAndTime; // eg, 1970-01-01 23:59:59
By the way, the MYDATEANDTIME column in my Oracle 11 database is of type DATE.
Some people on the Web suggest changing the database column's type to TIMESTAMP.
Is this the best solution to solving this date-or-time loss issue, or is there a better one?
Many thanks.
Philroc
|