[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5553) DbTimestamp uses local time for @Version field on Oracle 11g

Chris Pheby (JIRA) noreply at atlassian.com
Fri Sep 10 17:08:18 EDT 2010


DbTimestamp uses local time for @Version field on Oracle 11g
------------------------------------------------------------

                 Key: HHH-5553
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5553
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.6.0.Beta4, 3.6.0.Beta3, 3.5.5, 3.6.0.Beta2, 3.6.0.Beta1, 3.5.4, 3.5.3, 3.5.2, 3.5.1, 3.5.0-Final, 3.5.0-CR-2, 3.5.0-CR-1, 3.5.0-Beta-4, 3.5.0-Beta-3, 3.5.0-Beta-2, 3.5.0.Beta-1, 3.3.2
         Environment: Oracle 10g2
            Reporter: Chris Pheby
         Attachments: dbtimestamp.patch

When you using DbTimestamp to use the database to seed the timestamp (for the @Version oplock field), this delegates to getCurrentTimestampSelectString().

On Oracle 10g this invokes "select systimestamp from dual". This returns the server's local time. This causes problems when crossing the cutoff between (for example) British Summer Time and UTC. The standard SQL function, current_timestamp (returned by getCurrentTimestampSQLFunctionName should be used instead. This always returns UTC time.

	public String getCurrentTimestampSelectString() {
		return "select systimestamp from dual"; // suggest changing to 
                // return "select " + getCurrentTimestampSQLFunctionName() + " from dual";
	}

	public String getCurrentTimestampSQLFunctionName() {
		// the standard SQL function name is current_timestamp...
		return "current_timestamp";
	}

NB getCurrentTimestampSelectString() is only referenced from the DbTimestamp class

-- 
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