use of org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy in project hibernate-orm by hibernate.
the class InstantiationTests method runtimeModelTest.
@Test
public void runtimeModelTest(SessionFactoryScope scope) {
final RuntimeMetamodels runtimeMetamodels = scope.getSessionFactory().getRuntimeMetamodels();
final MappingMetamodel mappingMetamodel = runtimeMetamodels.getMappingMetamodel();
final EntityPersister entityDescriptor = mappingMetamodel.findEntityDescriptor(Person.class);
final EmbeddedAttributeMapping nameEmbedded = (EmbeddedAttributeMapping) entityDescriptor.findAttributeMapping("name");
final EmbeddableMappingType nameEmbeddable = nameEmbedded.getEmbeddableTypeDescriptor();
final EmbeddableRepresentationStrategy nameRepStrategy = nameEmbeddable.getRepresentationStrategy();
assertThat(nameRepStrategy.getMode()).isEqualTo(RepresentationMode.POJO);
assertThat(nameRepStrategy.getInstantiator()).isInstanceOf(NameInstantiator.class);
nameEmbeddable.forEachAttributeMapping((position, attribute) -> {
assertThat(attribute.getPropertyAccess().getSetter()).isNull();
});
}
use of org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy in project hibernate-orm by hibernate.
the class InstantiationTests method runtimeModelTest.
@Test
public void runtimeModelTest(SessionFactoryScope scope) {
final RuntimeMetamodels runtimeMetamodels = scope.getSessionFactory().getRuntimeMetamodels();
final MappingMetamodel mappingMetamodel = runtimeMetamodels.getMappingMetamodel();
final EntityPersister entityDescriptor = mappingMetamodel.findEntityDescriptor(Person.class);
final EmbeddedAttributeMapping nameEmbedded = (EmbeddedAttributeMapping) entityDescriptor.findAttributeMapping("name");
final EmbeddableMappingType nameEmbeddable = nameEmbedded.getEmbeddableTypeDescriptor();
final EmbeddableRepresentationStrategy nameRepStrategy = nameEmbeddable.getRepresentationStrategy();
assertThat(nameRepStrategy.getMode()).isEqualTo(RepresentationMode.POJO);
assertThat(nameRepStrategy.getInstantiator()).isInstanceOf(NameInstantiator.class);
nameEmbeddable.forEachAttributeMapping((position, attribute) -> {
assertThat(attribute.getPropertyAccess().getSetter()).isNull();
});
}
Aggregations