timestamp with jpa

so i have my jpa project with some really nice DAOs and i was really happy… all unit tests are up and running and everything looked good… but it wasnt…

i store timestamp(6) in the oracle db and the mapping class looks good and correct:

@Column(name = “TIME_ADDED”)
@Temporal(TemporalType.DATE)
private Date timeAdded;

the @Temporal defines the mapping type… and actual DATE is really only the date… TIMESTAMP is the thing i wanted…

The @Temporal annotation denotes, whether annotated property should be mapped to java.sql.Date (holds only date part), java.sql.Time (holds only time part) or to java.sql.Timestamp (holds date and time also with fractions of second). It has nothing to do with generation of property value.
(http://stackoverflow.com/questions/2591570/hibernate-reverse-engineering-procedure-generated-temporaltemporaltype-timestam)

and btw. unit tests will not find these errors… due to jpa caching… 🙁

Comments are closed.