diff --git a/ebean-core/src/main/java/io/ebeaninternal/api/ScopeTrans.java b/ebean-core/src/main/java/io/ebeaninternal/api/ScopeTrans.java index 1dbedb6eb9..348f1e4a48 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/api/ScopeTrans.java +++ b/ebean-core/src/main/java/io/ebeaninternal/api/ScopeTrans.java @@ -34,8 +34,8 @@ public final class ScopeTrans { * Explicit set of Exceptions that DO cause a rollback to occur. */ private final ArrayList> rollbackFor; - private Boolean restoreBatch; - private Boolean restoreBatchOnCascade; + private boolean restoreBatch; + private boolean restoreBatchOnCascade; private int restoreBatchSize; private Boolean restoreBatchGeneratedKeys; private boolean restoreBatchFlushOnQuery; @@ -61,7 +61,7 @@ public ScopeTrans(boolean rollbackOnChecked, boolean created, SpiTransaction tra this.noRollbackFor = txScope.getNoRollbackFor(); this.rollbackFor = txScope.getRollbackFor(); if (transaction != null) { - if (!created && txScope.isBatchSet() || txScope.isBatchOnCascadeSet() || txScope.isBatchSizeSet()) { + if (!created) { restoreBatch = transaction.isBatchMode(); restoreBatchOnCascade = transaction.isBatchOnCascade(); restoreBatchSize = transaction.getBatchSize(); @@ -143,15 +143,9 @@ void commitTransaction() { } else { nestedCommit = true; transaction.setFlushOnQuery(restoreBatchFlushOnQuery); - if (restoreBatch != null) { - transaction.setBatchMode(restoreBatch); - } - if (restoreBatchOnCascade != null) { - transaction.setBatchOnCascade(restoreBatchOnCascade); - } - if (restoreBatchSize > 0) { - transaction.setBatchSize(restoreBatchSize); - } + transaction.setBatchMode(restoreBatch); + transaction.setBatchOnCascade(restoreBatchOnCascade); + transaction.setBatchSize(restoreBatchSize); if (restoreBatchGeneratedKeys != null) { transaction.setGetGeneratedKeys(restoreBatchGeneratedKeys); }