HHH-16879 Handle parent injection in ComponentType#assemble

This commit is contained in:
Marco Belladelli 2023-08-02 10:35:58 +02:00
parent 6d47ef5ee9
commit 02d0058eec
1 changed files with 8 additions and 1 deletions

View File

@ -691,7 +691,14 @@ public class ComponentType extends AbstractType implements CompositeTypeImplemen
final EmbeddableInstantiator instantiator = mappingModelPart.getEmbeddableTypeDescriptor() final EmbeddableInstantiator instantiator = mappingModelPart.getEmbeddableTypeDescriptor()
.getRepresentationStrategy() .getRepresentationStrategy()
.getInstantiator(); .getInstantiator();
return instantiator.instantiate( () -> assembled, session.getFactory() ); final Object instance = instantiator.instantiate( () -> assembled, session.getFactory() );
final PropertyAccess parentInjectionAccess = mappingModelPart.getParentInjectionAttributePropertyAccess();
if ( parentInjectionAccess != null ) {
parentInjectionAccess.getSetter().set( instance, owner );
}
return instance;
} }
} }