Issue Type: Bug Bug
Affects Versions: 4.1.1
Assignee: Unassigned
Components: core
Created: 03/Dec/12 10:47 AM
Description:

The condition belows prints a warning in the file:

BatchingBatch.checkRowCounts()
if ( numberOfRowCounts != batchPosition ) {
  LOG.unexpectedRowCounts();
}
2012-12-03 17:36:10 org.hibernate.engine.jdbc.batch.internal.BatchingBatch checkRowCounts
WARN: HHH000381: JDBC driver did not return the expected number of row counts

In case of a single batch containing multiple statements the numberOfRowCounts != batchPosition check is incorrect.

Let's take a batch with two different prepared statements for two different update operations. BatchingBatch.batchPosition becomes 2 in the case. One any of the statements is executed in performExecution it properly returns an array rowCounts of length 1. The warning is therefore printed (as 1 != 2) although this situation is perfectly OK.

The potential fix could be to either remove the LOG.unexpectedRowCounts() instruction or enhance the warning condition by keeping separate batchPosition counters for different statements.

Please find the attached test case for clarification. It makes uses of dynamicUpdate to obtain multiple updates in one batch.

Environment: Hibernate 4.1.1, Oracle and H2
Project: Hibernate ORM
Priority: Minor Minor
Reporter: Karol Bienkowski
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira