Unexpected warning: "HHH100001: JDBC driver did not return the expected number of row counts"
Description
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
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 determiningexpectedNumberOfCounts
. In case when we are updating one entity (which will setbatchPosition
to 1 ) which for example extends entity with inheritance strategy set toInheritanceType.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 inorg.hibernate.engine.jdbc.batch.internal.BatchImpl.checkRowCounts
when logging warning expected and actual are switched. Attached test case produces warning, see the console after executionEdit: 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.