Unexpected warning: "HHH100001: JDBC driver did not return the expected number of row counts"

Description

When batching is turned on for entities that update multiple tables when updated following warn is logged:

HHH100001: JDBC driver did not return the expected number of row counts

Problem is in org.hibernate.engine.jdbc.batch.internal.BatchImpl.checkRowCounts when determining expectedNumberOfCounts. In case when we are updating one entity (which will set batchPosition to 1 ) which for example extends entity with inheritance strategy set to InheritanceType.JOINED , thus creating two update statements to be executed in DB, expectedNumberOfCounts will be wrongfully determined to be 0 (1/2) and warning will be logged. This is definitely wrong. Also in org.hibernate.engine.jdbc.batch.internal.BatchImpl.checkRowCounts when logging warning expected and actual are switched. Attached test case produces warning, see the console after execution

Edit: One more thing, in example described above (first entity inheriting other via InheritanceType.JOINED …) org.hibernate.engine.jdbc.batch.internal.BatchImpl.checkRowCounts is called only for identifier table, it seems that it should be called for all affected tables.

Attachments

2

Activity

Show:

Marcel Wollschläger May 30, 2023 at 2:35 PM

Building on top of the mentioned issue, here is a working example with a @ManyToOne relationship and Hibernate 6.1.7.Final:

Changing the version to any 6.2.x.Final version will trigger the warning

Fixed

Details

Assignee

Reporter

Sprint

Fix versions

Affects versions

Priority

Created May 29, 2023 at 3:29 PM
Updated January 17, 2025 at 5:40 PM
Resolved June 16, 2023 at 12:09 PM