HHH-17045 Use dynamic update when row-id is not available

This commit is contained in:
Marco Belladelli 2023-08-22 10:59:11 +02:00
parent efe7ee9809
commit d09237107e
No known key found for this signature in database
GPG Key ID: D1D0C3030AE3AA35

View File

@ -302,6 +302,7 @@ protected void performUpdate(
inclusionChecker,
lockingChecker,
dirtinessChecker,
rowId,
forceDynamicUpdate,
session
);
@ -619,6 +620,7 @@ private UpdateValuesAnalysisImpl analyzeUpdateValues(
InclusionChecker inclusionChecker,
InclusionChecker lockingChecker,
InclusionChecker dirtinessChecker,
Object rowId,
boolean forceDynamicUpdate,
SharedSessionContractImplementor session) {
final AbstractEntityPersister persister = entityPersister();
@ -635,6 +637,7 @@ private UpdateValuesAnalysisImpl analyzeUpdateValues(
oldValues,
dirtyAttributeIndexes,
dirtinessChecker,
rowId,
forceDynamicUpdate
);
@ -1291,6 +1294,7 @@ public UpdateValuesAnalysisImpl(
Object[] oldValues,
int[] dirtyAttributeIndexes,
InclusionChecker dirtinessChecker,
Object rowId,
boolean forceDynamicUpdate) {
this.values = values;
this.dirtyAttributeIndexes = dirtyAttributeIndexes;
@ -1337,6 +1341,9 @@ else if ( dirtyAttributeIndexes != null ) {
|| entityPersister().optimisticLockStyle() == DIRTY ) {
tablesNeedingDynamicUpdate.add( tableMapping );
}
else if ( rowId == null && entityPersister().getRowIdMapping() != null && tableMapping.isIdentifierTable() ) {
tablesNeedingDynamicUpdate.add( tableMapping );
}
}
}
} );
@ -1616,6 +1623,7 @@ private MutationOperationGroup buildStaticUpdateGroup() {
}
},
(index,attribute) -> true,
"", // pass anything here to generate the row id restriction if possible
false,
null
);