[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6259) failure trying to delete an @Entity with a NULL @Version timestamp using postgresql

radai (JIRA) noreply at atlassian.com
Thu May 26 03:31:25 EDT 2011


failure trying to delete an @Entity with a NULL @Version timestamp using postgresql
-----------------------------------------------------------------------------------

                 Key: HHH-6259
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6259
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.6.1
         Environment: jboss 6, hibernate 3.6.1, postgresql 9.0, JDBC4 driver, windows 7 x64
            Reporter: radai


given an @Entity with a Timestamp @Version property that happens to be NULL, hibernate fails to delete the entity, assuming the entity is dirty.

the root cause for this is the PreparedStatement hibernate generates. the sql string looks something along the lines of:
"delete from [table] where [idField]=? and [timestampField]=?"
hibernate then sets the 1st arg to the entity's id (non null) and then calls setNull() to set the 2nd parameter to null (the timestamp property for the entity is null). the postgres JDBC driver doesnt return any error, but executing the statement returns 0 rows, which in turn causes hibernate to assume the entity has been changed in the meantime and throw an exception.

apparently the postgresql jdbc4 driver expects "[timestampField] is null" in the sql string and nothing else.

im not sure if its hibernate or the postgresql driver at fault here, but the overall combnation of the two definitely does not work.

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