HHH-16672 Locking entities created in the same transaction fails
This commit is contained in:
parent
aba5ac47a0
commit
5eacb26f09
|
@ -107,8 +107,13 @@ public class LoaderHelper {
|
||||||
entry.forceLocked( object, nextVersion );
|
entry.forceLocked( object, nextVersion );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if ( entry.isExistsInDatabase() ) {
|
||||||
persister.lock( entry.getId(), entry.getVersion(), object, lockOptions, session );
|
persister.lock( entry.getId(), entry.getVersion(), object, lockOptions, session );
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
session.forceFlush( entry );
|
||||||
|
}
|
||||||
|
}
|
||||||
entry.setLockMode(requestedLockMode);
|
entry.setLockMode(requestedLockMode);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|
Loading…
Reference in New Issue