Fixed
Details
Assignee
Jan SchattemanJan SchattemanReporter
Jan SchattemanJan SchattemanComponents
Fix versions
Affects versions
Priority
Major
Details
Details
Assignee
Jan Schatteman
Jan SchattemanReporter
Jan Schatteman
Jan SchattemanComponents
Fix versions
Affects versions
Priority
Created April 8, 2025 at 6:23 PM
Updated last week
Resolved last week
There is a discrepancy in how a lockstring is generated between
org.hibernate.sql.ast.spi.AbstractSqlAstTranslator#renderForUpdateClause
andorg.hibernate.dialect.lock.AbstractSelectLockingStrategy.generateLockString
(*) that with postgresql raises an issue I believe.Say that you're multiloading natural id entities, and one of the instances is already loaded in the session, the latter leads to a call to upgradLock (which in turn calls (*) ), and generates something such as
select id from MyUser where id=? and version=? for update
, whereas the multiload itself generatesselect u1_0.id,u1_0.name,u1_0.version from MyUser u1_0 where u1_0.name = any (?) for no key update
, i.e. with a different lockThis behaviour can be seen in the
MultiLoadLockingTest.testMultiLoadSimpleIdEntityPessimisticWriteLockSomeInL1CAndSomeInL2C