Hello!
I have date time problem in Hibernate , in hibernate mapping i have provided the type "timestamp" , In pesistent class I have a java.util.Date type varialbe in which i m saving current date time, in MS sql server table i have datetime type column to persist this variable.
following is the date time before storing and after loading from database :the problem is that
sometimes it returns true indicating that the date is same ,but someimes it gives false :
It should be always true while i compare both objects that is before persistence and after loading from the data base the persisted value for tha object:
i think this problem iss not bcoz of hibernae , it is MS sql server datetime and
java Date calss type problem........plz eply me as soon as poosible , thanks in advance!
before storing Time obj1.getDate() = Wed Jun 23 10:21:56 GMT+05:00 2004
loading from database Time obj2.getDate()= 2004-06-23 10:21:56.093
Obj1.getDate().equals(obj2.getDate()) = true
before storing Time obj1.getDate()= Wed Jun 23 10:23:22 GMT+05:00 2004
loading from database Time obj2.getDate() = 2004-06-23 10:23:22.917
Obj1.getDate().equals(obj2.getDate()) time = false
before storing Time obj1.getDate() = Wed Jun 23 10:26:07 GMT+05:00 2004
loading from database Time obj2.getDate() = 2004-06-23 10:26:07.023
Obj1.getDate().equals(obj2.getDate()) Time = false
before storing Time obj1.getDate() = Wed Jun 23 10:27:18 GMT+05:00 2004
loading from database Time obj2.getDate() = 2004-06-23 10:27:18.497
Obj1.getDate().equals(obj2.getDate()) Time = true
before storing Time obj1.getDate() = Wed Jun 23 10:29:36 GMT+05:00 2004
loading from database Time obj2.getDate() = 2004-06-23 10:29:36.547
Obj1.getDate().equals(obj2.getDate()) Time = false