Misleading log info during batch execution

Description

Execution of batch statements generates a misleading log info when the hibernate.jdbc.batch_size <= 'current batch size'.
There are two different behaviours:
if (hibernate.jdbc.batch_size == 'current batch size') the log generated tell us "No batched statements to execute" (BatchingBatch.doExecuteBacth())

if(hibernate.jdbc.batch_size < 'current batch size') the log generated tell us "Executing batch size: x" with 'x' being the difference between 'current batch size' and hibernate.jdbc.batch_size.

I think it's because in BatchingBatch.addToBacth() we have:
...
if ( batchPosition == batchSize ) {
notifyObserversImplicitExecution();
performExecution();
batchPosition = 0;
}
...

And this execution is not being logged.
If the logging about "Executing batch size: x" is performed inside BatchingBatch.performExecution() method instead of BatchingBatch.doExecuteBatch(), the log generated is consistent.

Regards. Hernán.
I'll try to attach the test case soon.

Environment

None

Assignee

Brett Meyer

Reporter

Hernán Chanfreau

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure