HHH-17156 Skip initialization for different subtype embeddables

This commit is contained in:
Marco Belladelli 2023-09-06 11:10:10 +02:00
parent 32605a57e0
commit b38bc76d87
1 changed files with 4 additions and 0 deletions

View File

@ -267,6 +267,10 @@ public abstract class AbstractEmbeddableInitializer extends AbstractFetchParentA
// parent instance is null; // parent instance is null;
return State.NULL; return State.NULL;
} }
else if ( !entityInitializer.getConcreteDescriptor().isTypeOrSuperType( embedded.findContainingEntityMapping() ) ) {
// parent instance is of a supertype which doesn't contain this embeddable
return State.NULL;
}
else if ( entityInitializer.isEntityInitialized() ) { else if ( entityInitializer.isEntityInitialized() ) {
// parent instance has been initialized, we do not need to inject the state // parent instance has been initialized, we do not need to inject the state
return State.INJECTED; return State.INJECTED;