shengwangi.blogspot.de - <data:blog.pageName/> | <data:blog.title/>

Description: Tutorials and examples about Java/JEE, Spring, Hibernate, Maven

java (6058) spring (1266) j2ee (311) jee (153) struts (120) selenium (109) hibernate (84) maven (69) jsf (37) jsf 2.0 (2)

Example domain paragraphs

It’s a frequently encountered pitfall when using hibernate, also has entity with properties type defined as java.util.Date. 

In short, although the entity’s property is defined as java.util.Date in entity class, but at runtime hibernate will never set it as java.util.Date, but java.sql.Timestamp!

Since java.util.Date is the parent class of java.sql.Timestamp, so in your code whenever treat this field as java.util.Date, there is no exeption at compilation or runtime. But the unexpected result often come when the eqals operation involved.