[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5861) PersistenceUnitUtil.getIdentifier() returning zero instead of null

Archie Cobbs (JIRA) noreply at atlassian.com
Fri Jan 21 16:02:05 EST 2011


PersistenceUnitUtil.getIdentifier() returning zero instead of null
------------------------------------------------------------------

                 Key: HHH-5861
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5861
             Project: Hibernate Core
          Issue Type: Bug
          Components: entity-manager
    Affects Versions: 3.6.0
            Reporter: Archie Cobbs
            Priority: Minor


In one project my identifiers are Java {{long}} values and my code invoked {{PersistenceUnitUtil.getIdentifier()}} on an entity object which was either newly created and not yet persisted, or newly created and persisted but not yet actually saved (I'm not sure which case it was).

But either way, the method returned the wrong thing, namely zero instead of {{null}}. According to the Persistence API, it should have returned {{null}} instead of zero:
{quote}
_Return the id of the entity. A generated id is not guaranteed to be available until after the database insert has occurred. Returns null if the entity does not yet have an id._
{quote}


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