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