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 387cde33d1
commit ab36d29e1a
1 changed files with 6 additions and 0 deletions

View File

@ -1077,6 +1077,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
if ( attributeAnalysis.includeInLocking() ) {
final boolean includeRestriction = includeInRestriction(
oldValues,
dirtinessChecker,
versionMapping,
versionability,
@ -1156,6 +1157,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
}
private static boolean includeInRestriction(
Object[] oldValues,
DirtinessChecker dirtinessChecker,
EntityVersionMapping versionMapping,
boolean[] versionability,
@ -1163,11 +1165,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];
}