use of org.hibernate.metamodel.spi.EntityInstantiator in project hibernate-orm by hibernate.
the class AbstractEntityPersister method prepareMappingModel.
private void prepareMappingModel(MappingModelCreationProcess creationProcess, PersistentClass bootEntityDescriptor) {
final EntityInstantiator instantiator = getRepresentationStrategy().getInstantiator();
final Supplier<?> templateInstanceCreator;
if (!instantiator.canBeInstantiated()) {
templateInstanceCreator = null;
} else {
final LazyValue<?> templateCreator = new LazyValue<>(() -> instantiator.instantiate(creationProcess.getCreationContext().getSessionFactory()));
templateInstanceCreator = templateCreator::getValue;
}
identifierMapping = creationProcess.processSubPart(EntityIdentifierMapping.ROLE_LOCAL_NAME, (role, process) -> generateIdentifierMapping(templateInstanceCreator, bootEntityDescriptor, process));
versionMapping = generateVersionMapping(templateInstanceCreator, bootEntityDescriptor, creationProcess);
if (rowIdName == null) {
rowIdMapping = null;
} else {
rowIdMapping = creationProcess.processSubPart(rowIdName, (role, process) -> new EntityRowIdMappingImpl(rowIdName, this.getTableName(), this));
}
discriminatorMapping = generateDiscriminatorMapping(bootEntityDescriptor, creationProcess);
}
Aggregations