HHH-8494: Misleading log info during batch execution.
* Added a boolean variable to indicate if during addToBatch method the batchSize is reached and there is more than one batch execution. * The logging about performing a batch execution is moved to performExecution method. * The logging indicating that there is no statement to execute in batch is performed only if there was no previous batching execution.
This commit is contained in:
parent
6f6b3264f3
commit
be08e94aa5
|
@ -50,6 +50,7 @@ public class BatchingBatch extends AbstractBatchImpl {
|
|||
|
||||
private final int batchSize;
|
||||
private int batchPosition;
|
||||
private boolean alreadyExecuteBatch;
|
||||
private int statementPosition;
|
||||
|
||||
/**
|
||||
|
@ -96,6 +97,7 @@ public class BatchingBatch extends AbstractBatchImpl {
|
|||
notifyObserversImplicitExecution();
|
||||
performExecution();
|
||||
batchPosition = 0;
|
||||
alreadyExecuteBatch = true;
|
||||
}
|
||||
statementPosition = 0;
|
||||
}
|
||||
|
@ -103,16 +105,18 @@ public class BatchingBatch extends AbstractBatchImpl {
|
|||
|
||||
@Override
|
||||
protected void doExecuteBatch() {
|
||||
if ( batchPosition == 0 ) {
|
||||
LOG.debug( "No batched statements to execute" );
|
||||
if (batchPosition == 0 ) {
|
||||
if(!alreadyExecuteBatch) {
|
||||
LOG.debug( "No batched statements to execute" );
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG.debugf( "Executing batch size: %s", batchPosition );
|
||||
performExecution();
|
||||
}
|
||||
}
|
||||
|
||||
private void performExecution() {
|
||||
LOG.debugf( "Executing batch size: %s", batchPosition );
|
||||
try {
|
||||
for ( Map.Entry<String,PreparedStatement> entry : getStatements().entrySet() ) {
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue