[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5648) Auto-increment IDs should be assigned upon commit (or hooks made available)

Wallace Wadge (JIRA) noreply at atlassian.com
Tue Oct 12 02:59:57 EDT 2010


Auto-increment IDs should be assigned upon commit (or hooks made available)
---------------------------------------------------------------------------

                 Key: HHH-5648
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5648
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
         Environment: v3.6, mysql
            Reporter: Wallace Wadge


The connection pool BoneCP (http://jolbox.com) has support to automatically replay a transaction when a database/network goes down. Under hibernate, since objects get their IDs populated upon INSERTs, the following sequence of events is possible:

BEGIN TRANSACTION
   INSERT STATEMENT
   (object gets the ID field populated)

  => network goes down, new connection is given and transaction is replayed beneath hibernate

COMMIT TRANSACTION

Now the database has given us a new ID but hibernate never had a chance to update the object properly.

To fix: either assign the IDs upon a successful transaction commit or at least provide some kind of hooking mechanism so as to correct the problematic objects.

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