diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/engine/jdbc/batch/internal/BatchBuilderImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/engine/jdbc/batch/internal/BatchBuilderImpl.java index f8714c0b9..44ad721ae 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/engine/jdbc/batch/internal/BatchBuilderImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/engine/jdbc/batch/internal/BatchBuilderImpl.java @@ -61,9 +61,12 @@ public class BatchBuilderImpl implements BatchBuilder, Configurable, Manageable, @Override public Batch buildBatch(BatchKey key, JdbcCoordinator jdbcCoordinator) { - LOG.tracef( "Building batch [size=%s]", size ); - return size > 1 - ? new BatchingBatch( key, jdbcCoordinator, size ) + int batchSize = jdbcCoordinator.getJdbcSessionOwner().getJdbcBatchSize() > 1 + ? jdbcCoordinator.getJdbcSessionOwner().getJdbcBatchSize() + : size; + LOG.tracef( "Building batch [size=%s]", batchSize ); + return batchSize > 1 + ? new BatchingBatch( key, jdbcCoordinator, batchSize ) : new NonBatchingBatch( key, jdbcCoordinator ); } diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/internal/AbstractSessionImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/internal/AbstractSessionImpl.java index 50101c261..c55ccaddf 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/internal/AbstractSessionImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/internal/AbstractSessionImpl.java @@ -71,6 +71,7 @@ public abstract class AbstractSessionImpl protected transient SessionFactoryImpl factory; private final String tenantIdentifier; private boolean closed; + private int jdbcBatchSize; protected transient Transaction currentHibernateTransaction; protected transient WrapperOptionsImpl wrapperOptions; @@ -609,4 +610,14 @@ public abstract class AbstractSessionImpl return wrapperOptions; } + + @Override + public int getJdbcBatchSize() { + return jdbcBatchSize; + } + + @Override + public void setJdbcBatchSize(int jdbcBatchSize) { + this.jdbcBatchSize = jdbcBatchSize; + } } diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/resource/jdbc/spi/JdbcSessionOwner.java b/fine-hibernate/src/com/fr/third/org/hibernate/resource/jdbc/spi/JdbcSessionOwner.java index b8fa0acd9..0a45b7592 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/resource/jdbc/spi/JdbcSessionOwner.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/resource/jdbc/spi/JdbcSessionOwner.java @@ -43,4 +43,8 @@ public interface JdbcSessionOwner { public void afterTransactionCompletion(boolean successful, boolean delayed); public void flushBeforeTransactionCompletion(); + + public int getJdbcBatchSize(); + + public void setJdbcBatchSize(int jdbcBatchSize); }