Steve Dighans (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=712020%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiN2MxZTExNmJk...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16939?atlOrigin=eyJpIjoiN2MxZT...
) HHH-16939 (
https://hibernate.atlassian.net/browse/HHH-16939?atlOrigin=eyJpIjoiN2MxZT...
) Optimistic and Pessimisstic Force Increment Update Statements are not committed when
using a batch (
https://hibernate.atlassian.net/browse/HHH-16939?atlOrigin=eyJpIjoiN2MxZT...
)
Issue Type: Bug Affects Versions: 6.3.0, 6.2.6, 6.2.7 Assignee: Unassigned Components:
hibernate-core Created: 14/Jul/2023 19:47 PM Environment: Hibernate 6.2.6.Final
Java 17.0.7 (Temurin-17.0.7+7)
Windows 11
H2 DB 2.2.220 Priority: Major Reporter: Steve Dighans (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=712020%...
)
https://stackoverflow.com/q/76670939/22230165
JayVeeInCorp in the above question explains it better. I am going to try to summarize it
here.
When batch mode is on, hibernate.jdbc.batch_size > 0. The update statement(s) that
should increment the versioned column are not included in the committed batch. Then they
are released after original batch is closed.
I happened to find that question while trying to understand this message in my Spring Boot
3.1.1 project’s log HHH100503: On release of batch it still contained JDBC statements
The above message shows up, since it is an INFO level but it doesn’t point to a cause or
what was missing because of this.
An aside, not knowing a lot about this error, is there a reason HHH100503 message is INFO
and not WARN or even ERROR? Since data loss occurs it is hard to notice that this was part
of the cause.
I have ORMUnitTestCase that I am translating into a hibernate-orm/hibernate-core test PR
and will update this as soon as I have it ready.
The regression started between 6.1 and 6.2. With the current test case it is successful in
5.6.15.Final and 6.1.7.Final but fails on 6.2.0 and above including 6.2.6.Final,
6.2.7-SNAPSHOT and 6.3.0-SNAPSHOT.
Once I increased the log level
these two lines also show up in the debug/trace logs. Along with a lot of other ones I am
not sure which ones will be useful.
Log:
{{Releasing statement [prep3: update HHH123_Calendar set version=? where id=? and
version=?
{1: 2, 2: CAST(1 AS BIGINT), 3: 1}
]}}
HHH000420: Closing un-released batch
PreparedStatementDetails did not contain PreparedStatement on #releaseStatements : update
HHH123_Calendar set version=? where id=? and version=?
Log4j2 properties:
logger.hibernate-cache.name = org.hibernate.cache
logger.hibernate-cache.level = INFO
logger.hibernate-sql.name = org.hibernate.SQL
logger.hibernate-sql.level = DEBUG
logger.hibernate-orm-jdbc-bind.name = org.hibernate.orm.jdbc.bind
logger.hibernate-orm-jdbc-bind.level = TRACE
logger.hibernate-orm-jdbc-batch.name = org.hibernate.orm.jdbc.batch
logger.hibernate-orm-jdbc-batch.level = TRACE
logger.hibernate-resource-jdbc.name = org.hibernate.resource.jdbc
logger.hibernate-resource-jdbc.level = TRACE
logger.hibernate-resource-transaction.name = org.hibernate.resource.transaction
logger.hibernate-resource-transaction.level = TRACE
logger.hibernate-engine-jdbc.name = org.hibernate.engine.jdbc
logger.hibernate-engine-jdbc.level = TRACE
(
https://hibernate.atlassian.net/browse/HHH-16939#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16939#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100232- sha1:33a7c72 )