Skip to content

Commit 6954401

Browse files
committed
HHH-19840 Fix detection of post insert/update generated values
1 parent 66ac234 commit 6954401

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,9 @@ public EntityMetamodel(
310310
propertyInsertability[i] = writePropertyValue( (OnExecutionGenerator) generator );
311311
}
312312
foundPostInsertGeneratedValues = foundPostInsertGeneratedValues
313-
|| generator instanceof OnExecutionGenerator;
313+
|| generatedOnExecution;
314314
foundPreInsertGeneratedValues = foundPreInsertGeneratedValues
315+
|| !generatedOnExecution
315316
|| generator instanceof BeforeExecutionGenerator;
316317
}
317318
else if ( !allowMutation ) {
@@ -321,9 +322,10 @@ else if ( !allowMutation ) {
321322
if ( generatedOnExecution ) {
322323
propertyUpdateability[i] = writePropertyValue( (OnExecutionGenerator) generator );
323324
}
324-
foundPostUpdateGeneratedValues = foundPostUpdateGeneratedValues
325-
|| generator instanceof OnExecutionGenerator;
326-
foundPreUpdateGeneratedValues = foundPreUpdateGeneratedValues
325+
foundPostUpdateGeneratedValues = foundPostInsertGeneratedValues
326+
|| generatedOnExecution;
327+
foundPreUpdateGeneratedValues = foundPreInsertGeneratedValues
328+
|| !generatedOnExecution
327329
|| generator instanceof BeforeExecutionGenerator;
328330
}
329331
else if ( !allowMutation ) {

0 commit comments

Comments
 (0)