HHH-16713 Fix number of row counts check in BatchImpl

This commit is contained in:
Marco Belladelli 2023-06-15 10:35:28 +02:00
parent 1945c6736a
commit f66595f850
No known key found for this signature in database
GPG Key ID: D1D0C3030AE3AA35
1 changed files with 2 additions and 3 deletions

View File

@ -303,12 +303,11 @@ public class BatchImpl implements Batch {
private void checkRowCounts(int[] rowCounts, PreparedStatementDetails statementDetails) throws SQLException, HibernateException { private void checkRowCounts(int[] rowCounts, PreparedStatementDetails statementDetails) throws SQLException, HibernateException {
final int numberOfRowCounts = rowCounts.length; final int numberOfRowCounts = rowCounts.length;
if ( batchPosition != 0 ) { if ( batchPosition != 0 ) {
final int expectedNumberOfCounts = batchPosition / getStatementGroup().getNumberOfStatements(); if ( numberOfRowCounts != batchPosition ) {
if ( numberOfRowCounts != expectedNumberOfCounts ) {
JDBC_MESSAGE_LOGGER.unexpectedRowCounts( JDBC_MESSAGE_LOGGER.unexpectedRowCounts(
statementDetails.getMutatingTableDetails().getTableName(), statementDetails.getMutatingTableDetails().getTableName(),
numberOfRowCounts, numberOfRowCounts,
expectedNumberOfCounts batchPosition
); );
} }
} }