[hibernate-issues] [Hibernate-JIRA] Created: (HHH-7193) Transaction Rollback not clearing statement batch on Prepared Statement causes issues with statement caching

Shawn Clowater (JIRA) noreply at atlassian.com
Wed Mar 21 17:56:50 EDT 2012


Transaction Rollback not clearing statement batch on Prepared Statement causes issues with statement caching
------------------------------------------------------------------------------------------------------------

                 Key: HHH-7193
                 URL: https://hibernate.onjira.com/browse/HHH-7193
             Project: Hibernate ORM
          Issue Type: Bug
          Components: core
    Affects Versions: 4.1.1
         Environment: Hibernate 4.1.1 and before
Any connection provider that allows statement caching (i.e. C3P0)
            Reporter: Shawn Clowater


The AbstractBatchImpl closes the preparedStatement in a finally block but doesn't call clear in the event of a rollback.  This can leave the preparedStatment in a weird state if any type of statement caching is being used.

The issue is easily fixed by adding a clearBatch() call to the statement prior to close.  I was previously working around this by implementing my own BatchingBatcherFactory in Hib 3 but the API changed forcing me to look at it again.  I figured I might as well provide a global fix.

I'll add a pull request once I get github sorted.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list