HHH-17466 Fix HANA test issues the second

This commit is contained in:
Christian Beikov 2023-12-04 11:01:55 +01:00
parent 971a96d5bd
commit b1007cbda9
1 changed files with 8 additions and 8 deletions

View File

@ -22,6 +22,7 @@ import org.hibernate.metamodel.mapping.PluralAttributeMapping;
import org.hibernate.metamodel.mapping.internal.BasicAttributeMapping; import org.hibernate.metamodel.mapping.internal.BasicAttributeMapping;
import org.hibernate.metamodel.mapping.internal.BasicValuedCollectionPart; import org.hibernate.metamodel.mapping.internal.BasicValuedCollectionPart;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.JiraKey; import org.hibernate.testing.orm.junit.JiraKey;
@ -46,16 +47,15 @@ public class LocaleMappingTests {
@Test @Test
public void basicAssertions(SessionFactoryScope scope) { public void basicAssertions(SessionFactoryScope scope) {
final SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); final SessionFactoryImplementor sessionFactory = scope.getSessionFactory();
final Dialect dialect = sessionFactory.getJdbcServices().getDialect(); final JdbcTypeRegistry jdbcTypeRegistry = sessionFactory.getTypeConfiguration().getJdbcTypeRegistry();
final NationalizationSupport nationalizationSupport = dialect.getNationalizationSupport();
final EntityPersister entityDescriptor = sessionFactory.getMappingMetamodel().getEntityDescriptor( final EntityPersister entityDescriptor = sessionFactory.getMappingMetamodel().getEntityDescriptor(
LocaleMappingTestEntity.class ); LocaleMappingTestEntity.class );
{ {
final BasicAttributeMapping localeAttribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping( final BasicAttributeMapping localeAttribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping(
"locale" ); "locale" );
assertThat( localeAttribute.getJdbcMapping().getJdbcType().getJdbcTypeCode() ) assertThat( localeAttribute.getJdbcMapping().getJdbcType() )
.isEqualTo( nationalizationSupport.getVarcharVariantCode() ); .isEqualTo( jdbcTypeRegistry.getDescriptor( Types.VARCHAR ) );
assertThat( localeAttribute.getJdbcMapping().getJavaTypeDescriptor().getJavaTypeClass() ).isEqualTo( assertThat( localeAttribute.getJdbcMapping().getJavaTypeDescriptor().getJavaTypeClass() ).isEqualTo(
Locale.class ); Locale.class );
} }
@ -64,8 +64,8 @@ public class LocaleMappingTests {
final PluralAttributeMapping yearsAttribute = (PluralAttributeMapping) entityDescriptor.findAttributeMapping( final PluralAttributeMapping yearsAttribute = (PluralAttributeMapping) entityDescriptor.findAttributeMapping(
"locales" ); "locales" );
final BasicValuedCollectionPart elementDescriptor = (BasicValuedCollectionPart) yearsAttribute.getElementDescriptor(); final BasicValuedCollectionPart elementDescriptor = (BasicValuedCollectionPart) yearsAttribute.getElementDescriptor();
assertThat( elementDescriptor.getJdbcMapping().getJdbcType().getJdbcTypeCode() ) assertThat( elementDescriptor.getJdbcMapping().getJdbcType() )
.isEqualTo( nationalizationSupport.getVarcharVariantCode() ); .isEqualTo( jdbcTypeRegistry.getDescriptor( Types.VARCHAR ) );
assertThat( elementDescriptor.getJdbcMapping().getJavaTypeDescriptor().getJavaTypeClass() ).isEqualTo( assertThat( elementDescriptor.getJdbcMapping().getJavaTypeDescriptor().getJavaTypeClass() ).isEqualTo(
Locale.class ); Locale.class );
} }
@ -74,8 +74,8 @@ public class LocaleMappingTests {
final PluralAttributeMapping countByYearAttribute = (PluralAttributeMapping) entityDescriptor.findAttributeMapping( final PluralAttributeMapping countByYearAttribute = (PluralAttributeMapping) entityDescriptor.findAttributeMapping(
"countByLocale" ); "countByLocale" );
final BasicValuedCollectionPart keyDescriptor = (BasicValuedCollectionPart) countByYearAttribute.getIndexDescriptor(); final BasicValuedCollectionPart keyDescriptor = (BasicValuedCollectionPart) countByYearAttribute.getIndexDescriptor();
assertThat( keyDescriptor.getJdbcMapping().getJdbcType().getJdbcTypeCode() ) assertThat( keyDescriptor.getJdbcMapping().getJdbcType() )
.isEqualTo( nationalizationSupport.getVarcharVariantCode() ); .isEqualTo( jdbcTypeRegistry.getDescriptor( Types.VARCHAR ) );
assertThat( keyDescriptor.getJdbcMapping().getJavaTypeDescriptor().getJavaTypeClass() ).isEqualTo( assertThat( keyDescriptor.getJdbcMapping().getJavaTypeDescriptor().getJavaTypeClass() ).isEqualTo(
Locale.class ); Locale.class );
} }