mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-16 16:15:06 +00:00
HHH-16672 Locking entities created in the same transaction fails
This commit is contained in:
parent
c41d85887a
commit
cf386a1b47
@ -107,7 +107,12 @@ public static void upgradeLock(Object object, EntityEntry entry, LockOptions loc
|
||||
entry.forceLocked( object, nextVersion );
|
||||
}
|
||||
else {
|
||||
persister.lock( entry.getId(), entry.getVersion(), object, lockOptions, session );
|
||||
if ( entry.isExistsInDatabase() ) {
|
||||
persister.lock( entry.getId(), entry.getVersion(), object, lockOptions, session );
|
||||
}
|
||||
else {
|
||||
session.forceFlush( entry );
|
||||
}
|
||||
}
|
||||
entry.setLockMode(requestedLockMode);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user