use of org.hibernate.metamodel.mapping.internal.BasicAttributeMapping in project hibernate-orm by hibernate.
the class NativeQueryResultBuilderTests method verifyModel.
@BeforeAll
public void verifyModel(SessionFactoryScope scope) {
final EntityMappingType entityDescriptor = scope.getSessionFactory().getRuntimeMetamodels().getEntityMappingType(EntityOfBasics.class);
final JdbcTypeRegistry jdbcTypeRegistry = scope.getSessionFactory().getTypeConfiguration().getJdbcTypeRegistry();
final ModelPart part = entityDescriptor.findSubPart("convertedGender", null);
assertThat(part, instanceOf(BasicAttributeMapping.class));
final BasicAttributeMapping attrMapping = (BasicAttributeMapping) part;
assertThat(attrMapping.getJavaType().getJavaTypeClass(), equalTo(EntityOfBasics.Gender.class));
final BasicValueConverter valueConverter = attrMapping.getValueConverter();
assertThat(valueConverter, instanceOf(JpaAttributeConverter.class));
assertThat(valueConverter.getDomainJavaType(), is(attrMapping.getJavaType()));
assertThat(valueConverter.getRelationalJavaType().getJavaTypeClass(), equalTo(Character.class));
assertThat(attrMapping.getJdbcMapping().getJdbcType(), is(jdbcTypeRegistry.getDescriptor(Types.CHAR)));
}
Aggregations