JDBC Batching doesn't work AbstractEntityPersister isBatchable

Description

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

1 2 3 4 public boolean isBatchable() { return optimisticLockStyle() == OptimisticLockStyle.NONE || ( !isVersioned() && optimisticLockStyle() == OptimisticLockStyle.VERSION ) || getFactory().getSettings().isJdbcBatchVersionedData();

The first term is presumably is that pessimistic locking is being used.

The third term indicated that versioning can be used as hibernate.jdbc.batch_versioned_data has been set to true indicating that the driver return correct row counts for executeBatch.

I presume the second term "should" return true if the entity is versioned and hibernate versioning is being used, it does not.

UNLESS the intention was to explicitly disable batching if Hibernate Versioning is being used.

Environment

All Hibernate versions, all environments

Status

Assignee

Unassigned

Reporter

Paul Anderson

Fix versions

None

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.2.10

Priority

Major