Following the relevant code-snippets in Hibernate 4.1.8:
org.hibernate.cfg.SettingsFactory.java
Code:
int batchSize = ConfigurationHelper.getInt(AvailableSettings.STATEMENT_BATCH_SIZE, properties, 0);
if ( !meta.supportsBatchUpdates() ) {
batchSize = 0;
}
if ( batchSize > 0 && debugEnabled ) {
LOG.debugf( "JDBC batch size: %s", batchSize );
}
settings.setJdbcBatchSize(batchSize);
org.hibernate.engine.jdbc.batch.internal.BatchBuilderImpl.java
Code:
public class BatchBuilderImpl implements BatchBuilder, Configurable {
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, BatchBuilderImpl.class.getName() );
private int size;
public BatchBuilderImpl() {
}
@Override
public void configure(Map configurationValues) {
size = ConfigurationHelper.getInt( Environment.STATEMENT_BATCH_SIZE, configurationValues, size );
}
public BatchBuilderImpl(int size) {
this.size = size;
}
public void setJdbcBatchSize(int size) {
this.size = size;
}
@Override
public Batch buildBatch(BatchKey key, JdbcCoordinator jdbcCoordinator) {
LOG.tracef( "Building batch [size=%s]", size );
return size > 1
? new BatchingBatch( key, jdbcCoordinator, size )
: new NonBatchingBatch( key, jdbcCoordinator );
}
...
I put some breakpoint to see if this pieces of code are effectively executed:
They get executed, so there's no reason why jdbc batching should not work anymore as described.