It would appear that JDBC batching, when using Optimistic locking and Hibernate Versioning cannot work.
If you look at AbstractEntityPersister.isBatchable it evaluates 3 terms to determine is JDBC batching (addBatch/executeBatch) should be used, true on any of the 3 terms enables batching
{code:java} public boolean isBatchable() { return optimisticLockStyle() == OptimisticLockStyle.NONE || ( !isVersioned() && optimisticLockStyle() == OptimisticLockStyle.VERSION ) || getFactory().getSettings().isJdbcBatchVersionedData(); {code}
The first term is presumably is that pessimistic locking is being used.
The third term indicated that versioning is being handled by the database.
The Second term "should" return true if the entity is versioned and hibernate versioning is being used.
However you will notice the logical NOT in front if isVersioned(), it should not be there.
*UNLESS* the intention was to explicitly disable batching if Hibernate Versioning is being used.
I have tested/profiled a number of applications and quite simply removing the NOT enables hibernates JDBC batching mechanism. |
|