@@ -4646,7 +4646,7 @@ private void prepareMappings(MappingModelCreationProcess creationProcess) {
46464646 creationProcess .getCreationContext ().getBootModel ()
46474647 .getEntityBinding ( getEntityName () );
46484648 initializeSpecialAttributeMappings ( creationProcess , persistentClass );
4649- versionGenerator = createVersionGenerator ( this , versionMapping );
4649+ versionGenerator = createVersionGenerator ( super . getVersionGenerator () , versionMapping );
46504650 buildDeclaredAttributeMappings ( creationProcess , persistentClass );
46514651 getAttributeMappings ();
46524652 initializeNaturalIdMapping ( creationProcess , persistentClass );
@@ -4705,15 +4705,15 @@ private void inheritSupertypeSpecialAttributeMappings() {
47054705 }
47064706 }
47074707
4708- private static BeforeExecutionGenerator createVersionGenerator
4709- ( EntityMetamodel currentEntityMetamodel , EntityVersionMapping versionMapping ) {
4710- if ( currentEntityMetamodel . isVersioned () ) {
4711- final var generator = currentEntityMetamodel . getVersionGenerator ();
4708+ private static @ Nullable BeforeExecutionGenerator createVersionGenerator (
4709+ @ Nullable BeforeExecutionGenerator configuredGenerator ,
4710+ @ Nullable EntityVersionMapping versionMapping ) {
4711+ if ( versionMapping != null ) {
47124712 // need to do this here because EntityMetamodel doesn't have the EntityVersionMapping :-(
4713- return generator == null ? new VersionGeneration ( versionMapping ) : generator ;
4713+ return configuredGenerator == null ? new VersionGeneration ( versionMapping ) : configuredGenerator ;
47144714 }
47154715 else {
4716- return null ;
4716+ return configuredGenerator ;
47174717 }
47184718 }
47194719
0 commit comments