use of org.hibernate.type.spi.CompositeTypeImplementor in project hibernate-orm by hibernate.
the class EmbeddableMappingTypeImpl method from.
public static EmbeddableMappingTypeImpl from(Component bootDescriptor, CompositeType compositeType, String rootTableExpression, String[] rootTableKeyColumnNames, Function<EmbeddableMappingType, EmbeddableValuedModelPart> embeddedPartBuilder, MappingModelCreationProcess creationProcess) {
final RuntimeModelCreationContext creationContext = creationProcess.getCreationContext();
final EmbeddableMappingTypeImpl mappingType = new EmbeddableMappingTypeImpl(bootDescriptor, embeddedPartBuilder, creationContext);
if (compositeType instanceof CompositeTypeImplementor) {
((CompositeTypeImplementor) compositeType).injectMappingModelPart(mappingType.getEmbeddedValueMapping(), creationProcess);
}
creationProcess.registerInitializationCallback("EmbeddableMappingType(" + mappingType.getNavigableRole().getFullPath() + ")#finishInitialization", () -> mappingType.finishInitialization(bootDescriptor, compositeType, rootTableExpression, rootTableKeyColumnNames, creationProcess));
return mappingType;
}
use of org.hibernate.type.spi.CompositeTypeImplementor in project hibernate-orm by hibernate.
the class ComponentBasicProxyTest method testOnlyOneProxyClassGenerated.
@Test
@TestForIssue(jiraKey = "HHH-12791")
public void testOnlyOneProxyClassGenerated(DomainModelScope domainModelScope, SessionFactoryScope sfScope) {
final SessionFactoryImplementor sessionFactory = sfScope.getSessionFactory();
final PersistentClass personDescriptor = domainModelScope.getDomainModel().getEntityBinding(Person.class.getName());
final CompositeTypeImplementor componentType = (CompositeTypeImplementor) personDescriptor.getIdentifierMapper().getType();
final EmbeddableValuedModelPart embedded = componentType.getMappingModelPart();
final EmbeddableInstantiator instantiator = embedded.getEmbeddableTypeDescriptor().getRepresentationStrategy().getInstantiator();
final Object instance1 = instantiator.instantiate(null, sessionFactory);
final Object instance2 = instantiator.instantiate(null, sessionFactory);
assertThat(instance1.getClass()).isEqualTo(instance2.getClass());
}
Aggregations