Skip to content

Commit

Permalink
HHH-17466 Fix HANA test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
beikov committed Dec 1, 2023
1 parent c67ea33 commit 314c621
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import java.util.Map;
import java.util.Set;

import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.NationalizationSupport;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
import org.hibernate.metamodel.mapping.internal.BasicAttributeMapping;
Expand Down Expand Up @@ -44,13 +46,16 @@ public class LocaleMappingTests {
@Test
public void basicAssertions(SessionFactoryScope scope) {
final SessionFactoryImplementor sessionFactory = scope.getSessionFactory();
final Dialect dialect = sessionFactory.getJdbcServices().getDialect();
final NationalizationSupport nationalizationSupport = dialect.getNationalizationSupport();
final EntityPersister entityDescriptor = sessionFactory.getMappingMetamodel().getEntityDescriptor(
LocaleMappingTestEntity.class );

{
final BasicAttributeMapping localeAttribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping(
"locale" );
assertThat( localeAttribute.getJdbcMapping().getJdbcType().getJdbcTypeCode() ).isEqualTo( Types.VARCHAR );
assertThat( localeAttribute.getJdbcMapping().getJdbcType().getJdbcTypeCode() )
.isEqualTo( nationalizationSupport.getVarcharVariantCode() );
assertThat( localeAttribute.getJdbcMapping().getJavaTypeDescriptor().getJavaTypeClass() ).isEqualTo(
Locale.class );
}
Expand All @@ -59,7 +64,8 @@ public void basicAssertions(SessionFactoryScope scope) {
final PluralAttributeMapping yearsAttribute = (PluralAttributeMapping) entityDescriptor.findAttributeMapping(
"locales" );
final BasicValuedCollectionPart elementDescriptor = (BasicValuedCollectionPart) yearsAttribute.getElementDescriptor();
assertThat( elementDescriptor.getJdbcMapping().getJdbcType().getJdbcTypeCode() ).isEqualTo( Types.VARCHAR );
assertThat( elementDescriptor.getJdbcMapping().getJdbcType().getJdbcTypeCode() )
.isEqualTo( nationalizationSupport.getVarcharVariantCode() );
assertThat( elementDescriptor.getJdbcMapping().getJavaTypeDescriptor().getJavaTypeClass() ).isEqualTo(
Locale.class );
}
Expand All @@ -68,7 +74,8 @@ public void basicAssertions(SessionFactoryScope scope) {
final PluralAttributeMapping countByYearAttribute = (PluralAttributeMapping) entityDescriptor.findAttributeMapping(
"countByLocale" );
final BasicValuedCollectionPart keyDescriptor = (BasicValuedCollectionPart) countByYearAttribute.getIndexDescriptor();
assertThat( keyDescriptor.getJdbcMapping().getJdbcType().getJdbcTypeCode() ).isEqualTo( Types.VARCHAR );
assertThat( keyDescriptor.getJdbcMapping().getJdbcType().getJdbcTypeCode() )
.isEqualTo( nationalizationSupport.getVarcharVariantCode() );
assertThat( keyDescriptor.getJdbcMapping().getJavaTypeDescriptor().getJavaTypeClass() ).isEqualTo(
Locale.class );
}
Expand Down

0 comments on commit 314c621

Please sign in to comment.