[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4920) TimeStamp instead of Date Object behind @Temporal(TemporalType.TIMESTAMP)

Yves Senn (JIRA) noreply at atlassian.com
Tue Feb 16 03:55:36 EST 2010


TimeStamp instead of Date Object behind @Temporal(TemporalType.TIMESTAMP)
-------------------------------------------------------------------------

                 Key: HHH-4920
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4920
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.5.0-Beta-3
            Reporter: Yves Senn


As stated in the java api (http://java.sun.com/javase/6/docs/api/java/sql/Timestamp.html)
"Due to the differences between the Timestamp class and the java.util.Date class mentioned above, it is recommended that code not view Timestamp values generically as an instance of java.util.Date. The inheritance relationship between Timestamp and java.util.Date really denotes implementation inheritance, and not type inheritance. "

A Timestamp object should not be hided by a Date object. Therefore hibernate should no place a Timestamp object behind that.

	@NotNull
	@Temporal(TemporalType.TIMESTAMP)
	private Timestamp createDate;

Instead hibernate has to do something like this behind the scences:
createDate = new Date(createDateTimestamp.getTime())

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list