Bug 1211402

Summary: (6.4.z)HHH-9413 - NonBatchingBatch.addToBatch() calls statement.close() twice
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Gail Badner <gbadner>
Component: HibernateAssignee: Gail Badner <gbadner>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Simka <msimka>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4.0CC: cdewolf, gbadner, hsvabek, jawilson, msimka, sfikes, smarlow
Target Milestone: CR1   
Target Release: EAP 6.4.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1233408 (view as bug list) Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1196113, 1219165, 1233408    

Description Gail Badner 2015-04-13 22:24:49 UTC
Description of problem:

NonBatchingBatch.addToBatch() method calls jdbcCoordinator.release(Statement)) for each statement, which ultimately closes the statement. At the end of addToBatch(), releaseStatements() is called, which repeats the same operation for each statement.

Depending on the DB, an exception can be thrown when Hibernate tries to operate on the closed statement. This exception is ignored, but is logged for each statement, which can be very noisy.

This is a regression caused by:
https://bugzilla.redhat.com/show_bug.cgi?id=1111206
https://hibernate.atlassian.net/browse/HHH-9252

Version-Release number of selected component (if applicable):


How reproducible:
Reproduces using SQL Server 2008, also when using tomcat jdbc-pool (see HHH-8853) 

Steps to Reproduce:
1.
2.
3.

Actual results:

Exception is thrown, logged, and ignored.

Expected results:

There should be no exception. After releasing the statements, NonBatchingBatch.addToBatch(), should just clear the batch statements (rather than releasing them again). 


Additional info:

Comment 1 Gail Badner 2015-04-13 22:40:31 UTC
This is fixed upstream in 4.2 branch by commit: https://github.com/hibernate/hibernate-orm/commit/6d4dd52f8d361116f53ab5139d2a0e772ccc8325 .

Comment 6 hsvabek 2015-06-23 06:01:04 UTC
Verified.
hibernate-core-4.2.19.Final is OK.

Comment 7 Petr Penicka 2017-01-17 10:15:52 UTC
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.

Comment 8 Petr Penicka 2017-01-17 10:16:15 UTC
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.