When enabling spring.jpa.properties.hibernate.jdbc.batch_size there's a regression between spring boot 3.0.7 and 3.1.0

You can find the example project attached. When running the included test you can find in the logs: PreparedStatementDetails did not contain PreparedStatement on #releaseStatements : update room set version=? where id=? and version=?

When disabling the spring.jpa.properties.hibernate.jdbc.batch_size property, the error goes away.

This worked fine in spring boot 3.0.7 with the property enabled.

This issue causes some bugs in our project because sometimes an update query is not flushed to the database (without any exception thrown). It worked completely fine in 3.0.7 and also in 3.1.0 with the batch_size property disabled.

reproduce-batch-size-issue-example.zip

Comment From: wilkinsona

Thanks for the sample. The difference in behavior appears to be due to changes in Hibernate 6.2. It does not occur when the sample is updated the use Hibernate 6.1.7.Final by setting <hibernate.version>6.1.7.Final</hibernate.version>. This is not surprising as the debug logging that you have identified was added in Hibernate 6.2.

This issue causes some bugs in our project because sometimes an update query is not flushed to the database (without any exception thrown). It worked completely fine in 3.0.7 and also in 3.1.0 with the batch_size property disabled.

It's not clear what this bug is because the sample does not appear to reproduce it. As noted above, the logging that you have identified is new in Hibernate 6.2 so I suspect that its appearance is a symptom of the problem rather than the cause.

I think your best course of action is to update your minimal example so that it reproduces the problem where an update is not flushed to the database and fails because of it. Once you have that updated example, I would open a Hibernate issue.