HHH-16839 Failing to update a one-to-one lazy association with and enabled bytecode enhancement

This commit is contained in:
Andrea Boriero 2023-06-26 18:24:25 +02:00 committed by Andrea Boriero
parent becb11698e
commit 1980da784d
1 changed files with 6 additions and 0 deletions

View File

@ -1076,6 +1076,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
if ( attributeAnalysis.includeInLocking() ) {
final boolean includeRestriction = includeInRestriction(
oldValues,
dirtinessChecker,
versionMapping,
versionability,
@ -1155,6 +1156,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
}
private static boolean includeInRestriction(
Object[] oldValues,
DirtinessChecker dirtinessChecker,
EntityVersionMapping versionMapping,
boolean[] versionability,
@ -1162,11 +1164,15 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
int attributeIndex,
AttributeMapping attributeMapping,
AttributeAnalysis attributeAnalysis) {
if ( optimisticLockStyle == OptimisticLockStyle.VERSION
&& versionMapping != null
&& attributeMapping == versionMapping.getVersionAttribute() ) {
return true;
}
else if ( oldValues == null ) {
return false;
}
else if ( optimisticLockStyle == OptimisticLockStyle.ALL ) {
return versionability[attributeIndex];
}