Skip to content

Commit 900cbe8

Browse files
committed
HHH-19840 Fix detection of post insert/update generated values
1 parent a940f36 commit 900cbe8

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
@@ -354,8 +354,9 @@ public EntityMetamodel(
354354
propertyInsertability[i] = writePropertyValue( (OnExecutionGenerator) generator );
355355
}
356356
foundPostInsertGeneratedValues = foundPostInsertGeneratedValues
357-
|| generator instanceof OnExecutionGenerator;
357+
|| generatedOnExecution;
358358
foundPreInsertGeneratedValues = foundPreInsertGeneratedValues
359+
|| !generatedOnExecution
359360
|| generator instanceof BeforeExecutionGenerator;
360361
}
361362
else if ( !allowMutation ) {
@@ -365,9 +366,10 @@ else if ( !allowMutation ) {
365366
if ( generatedOnExecution ) {
366367
propertyUpdateability[i] = writePropertyValue( (OnExecutionGenerator) generator );
367368
}
368-
foundPostUpdateGeneratedValues = foundPostUpdateGeneratedValues
369-
|| generator instanceof OnExecutionGenerator;
370-
foundPreUpdateGeneratedValues = foundPreUpdateGeneratedValues
369+
foundPostUpdateGeneratedValues = foundPostInsertGeneratedValues
370+
|| generatedOnExecution;
371+
foundPreUpdateGeneratedValues = foundPreInsertGeneratedValues
372+
|| !generatedOnExecution
371373
|| generator instanceof BeforeExecutionGenerator;
372374
}
373375
else if ( !allowMutation ) {

0 commit comments

Comments
 (0)