Use NationalizationSupport in some tests to fix HANA test issues
This commit is contained in:
parent
187b42391f
commit
4453681e00
|
@ -13,6 +13,7 @@ import org.hibernate.boot.MetadataSources;
|
|||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.hibernate.dialect.NationalizationSupport;
|
||||
import org.hibernate.mapping.Collection;
|
||||
import org.hibernate.mapping.Column;
|
||||
import org.hibernate.mapping.Component;
|
||||
|
@ -44,7 +45,9 @@ public class NestedEmbeddableMetadataTest {
|
|||
final Metadata metadata = new MetadataSources( serviceRegistry )
|
||||
.addAnnotatedClass( Customer.class )
|
||||
.buildMetadata();
|
||||
final TypeConfiguration typeConfiguration = metadata.getDatabase().getTypeConfiguration();
|
||||
final NationalizationSupport nationalizationSupport = metadata.getDatabase()
|
||||
.getDialect()
|
||||
.getNationalizationSupport();
|
||||
|
||||
PersistentClass classMetadata = metadata.getEntityBinding( Customer.class.getName() );
|
||||
Property investmentsProperty = classMetadata.getProperty( "investments" );
|
||||
|
@ -58,7 +61,10 @@ public class NestedEmbeddableMetadataTest {
|
|||
SimpleValue currencyMetadata = (SimpleValue) amountMetadata.getProperty( "currency" ).getValue();
|
||||
int[] currencySqlTypes = currencyMetadata.getType().getSqlTypeCodes( metadata );
|
||||
assertEquals(1, currencySqlTypes.length);
|
||||
assertJdbcTypeCode(new int[]{Types.VARCHAR, SqlTypes.ENUM}, currencySqlTypes[0]);
|
||||
assertJdbcTypeCode(
|
||||
new int[] { nationalizationSupport.getVarcharVariantCode(), SqlTypes.ENUM },
|
||||
currencySqlTypes[0]
|
||||
);
|
||||
}
|
||||
finally {
|
||||
StandardServiceRegistryBuilder.destroy( serviceRegistry );
|
||||
|
|
|
@ -6,12 +6,11 @@
|
|||
*/
|
||||
package org.hibernate.orm.test.annotations.embeddables.nested.fieldaccess;
|
||||
|
||||
import java.sql.Types;
|
||||
|
||||
import org.hibernate.boot.Metadata;
|
||||
import org.hibernate.boot.MetadataSources;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.dialect.NationalizationSupport;
|
||||
import org.hibernate.mapping.Collection;
|
||||
import org.hibernate.mapping.Column;
|
||||
import org.hibernate.mapping.Component;
|
||||
|
@ -20,7 +19,6 @@ import org.hibernate.mapping.Property;
|
|||
import org.hibernate.mapping.SimpleValue;
|
||||
import org.hibernate.mapping.Value;
|
||||
import org.hibernate.type.SqlTypes;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
@ -40,7 +38,9 @@ public class FieldAccessedNestedEmbeddableMetadataTest {
|
|||
final Metadata metadata = new MetadataSources( ssr )
|
||||
.addAnnotatedClass( Customer.class )
|
||||
.buildMetadata();
|
||||
final TypeConfiguration typeConfiguration = metadata.getDatabase().getTypeConfiguration();
|
||||
final NationalizationSupport nationalizationSupport = metadata.getDatabase()
|
||||
.getDialect()
|
||||
.getNationalizationSupport();
|
||||
|
||||
PersistentClass classMetadata = metadata.getEntityBinding( Customer.class.getName() );
|
||||
Property investmentsProperty = classMetadata.getProperty( "investments" );
|
||||
|
@ -55,7 +55,7 @@ public class FieldAccessedNestedEmbeddableMetadataTest {
|
|||
int[] currencySqlTypes = currencyMetadata.getType().getSqlTypeCodes( metadata );
|
||||
assertEquals( 1, currencySqlTypes.length );
|
||||
assertJdbcTypeCode(
|
||||
new int[]{Types.VARCHAR, SqlTypes.ENUM},
|
||||
new int[] { nationalizationSupport.getVarcharVariantCode(), SqlTypes.ENUM },
|
||||
currencySqlTypes[0]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ package org.hibernate.orm.test.mapping;
|
|||
import java.sql.Statement;
|
||||
import java.sql.Types;
|
||||
|
||||
import org.hibernate.dialect.NationalizationSupport;
|
||||
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
|
||||
import org.hibernate.metamodel.mapping.ModelPart;
|
||||
import org.hibernate.metamodel.mapping.internal.BasicAttributeMapping;
|
||||
|
@ -70,6 +71,10 @@ public class SmokeTests {
|
|||
final JdbcTypeRegistry jdbcTypeRegistry = entityDescriptor.getFactory()
|
||||
.getTypeConfiguration()
|
||||
.getJdbcTypeRegistry();
|
||||
final NationalizationSupport nationalizationSupport = scope.getSessionFactory()
|
||||
.getJdbcServices()
|
||||
.getDialect()
|
||||
.getNationalizationSupport();
|
||||
|
||||
final EntityIdentifierMapping identifierMapping = entityDescriptor.getIdentifierMapping();
|
||||
assertThat(
|
||||
|
@ -122,7 +127,7 @@ public class SmokeTests {
|
|||
|
||||
assertThat(
|
||||
jdbcMapping.getJdbcType().getJdbcTypeCode(),
|
||||
isOneOf( SqlTypes.ENUM, SqlTypes.VARCHAR )
|
||||
isOneOf( SqlTypes.ENUM, nationalizationSupport.getVarcharVariantCode() )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue