use of org.hibernate.metamodel.mapping.internal.BasicValuedCollectionPart in project hibernate-orm by hibernate.
the class YearMappingTests method basicAssertions.
@Test
public void basicAssertions(SessionFactoryScope scope) {
final SessionFactoryImplementor sessionFactory = scope.getSessionFactory();
final EntityPersister entityDescriptor = sessionFactory.getMappingMetamodel().getEntityDescriptor(YearMappingTestEntity.class);
{
final BasicAttributeMapping yearAttribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("year");
assertThat(yearAttribute.getJdbcMapping().getJdbcType().getJdbcTypeCode()).isEqualTo(Types.INTEGER);
assertThat(yearAttribute.getJdbcMapping().getJavaTypeDescriptor().getJavaTypeClass()).isEqualTo(Year.class);
}
{
final PluralAttributeMapping yearsAttribute = (PluralAttributeMapping) entityDescriptor.findAttributeMapping("years");
final BasicValuedCollectionPart elementDescriptor = (BasicValuedCollectionPart) yearsAttribute.getElementDescriptor();
assertThat(elementDescriptor.getJdbcMapping().getJdbcType().getJdbcTypeCode()).isEqualTo(Types.INTEGER);
assertThat(elementDescriptor.getJdbcMapping().getJavaTypeDescriptor().getJavaTypeClass()).isEqualTo(Year.class);
}
{
final PluralAttributeMapping countByYearAttribute = (PluralAttributeMapping) entityDescriptor.findAttributeMapping("countByYear");
final BasicValuedCollectionPart keyDescriptor = (BasicValuedCollectionPart) countByYearAttribute.getIndexDescriptor();
assertThat(keyDescriptor.getJdbcMapping().getJdbcType().getJdbcTypeCode()).isEqualTo(Types.INTEGER);
assertThat(keyDescriptor.getJdbcMapping().getJavaTypeDescriptor().getJavaTypeClass()).isEqualTo(Year.class);
}
}
Aggregations