Use VARCHAR registered JdbcType's type code instead of NationalizationSupport to fix HANA test issues
This commit is contained in:
parent
c1c912d034
commit
cbf5ee8e45
|
@ -6,14 +6,11 @@
|
|||
*/
|
||||
package org.hibernate.orm.test.annotations.embeddables.nested;
|
||||
|
||||
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.cfg.AvailableSettings;
|
||||
import org.hibernate.dialect.NationalizationSupport;
|
||||
import org.hibernate.mapping.Collection;
|
||||
import org.hibernate.mapping.Column;
|
||||
import org.hibernate.mapping.Component;
|
||||
|
@ -22,7 +19,7 @@ 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.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
@ -45,9 +42,9 @@ public class NestedEmbeddableMetadataTest {
|
|||
final Metadata metadata = new MetadataSources( serviceRegistry )
|
||||
.addAnnotatedClass( Customer.class )
|
||||
.buildMetadata();
|
||||
final NationalizationSupport nationalizationSupport = metadata.getDatabase()
|
||||
.getDialect()
|
||||
.getNationalizationSupport();
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = metadata.getDatabase()
|
||||
.getTypeConfiguration()
|
||||
.getJdbcTypeRegistry();
|
||||
|
||||
PersistentClass classMetadata = metadata.getEntityBinding( Customer.class.getName() );
|
||||
Property investmentsProperty = classMetadata.getProperty( "investments" );
|
||||
|
@ -62,7 +59,7 @@ public class NestedEmbeddableMetadataTest {
|
|||
int[] currencySqlTypes = currencyMetadata.getType().getSqlTypeCodes( metadata );
|
||||
assertEquals(1, currencySqlTypes.length);
|
||||
assertJdbcTypeCode(
|
||||
new int[] { nationalizationSupport.getVarcharVariantCode(), SqlTypes.ENUM },
|
||||
new int[] { jdbcTypeRegistry.getDescriptor( SqlTypes.VARCHAR ).getJdbcTypeCode(), SqlTypes.ENUM },
|
||||
currencySqlTypes[0]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ 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;
|
||||
|
@ -19,6 +18,7 @@ import org.hibernate.mapping.Property;
|
|||
import org.hibernate.mapping.SimpleValue;
|
||||
import org.hibernate.mapping.Value;
|
||||
import org.hibernate.type.SqlTypes;
|
||||
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
@ -38,9 +38,9 @@ public class FieldAccessedNestedEmbeddableMetadataTest {
|
|||
final Metadata metadata = new MetadataSources( ssr )
|
||||
.addAnnotatedClass( Customer.class )
|
||||
.buildMetadata();
|
||||
final NationalizationSupport nationalizationSupport = metadata.getDatabase()
|
||||
.getDialect()
|
||||
.getNationalizationSupport();
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = metadata.getDatabase()
|
||||
.getTypeConfiguration()
|
||||
.getJdbcTypeRegistry();
|
||||
|
||||
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[] { nationalizationSupport.getVarcharVariantCode(), SqlTypes.ENUM },
|
||||
new int[] { jdbcTypeRegistry.getDescriptor( SqlTypes.VARCHAR ).getJdbcTypeCode(), SqlTypes.ENUM },
|
||||
currencySqlTypes[0]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,25 +9,24 @@ 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;
|
||||
import org.hibernate.metamodel.mapping.internal.EmbeddedAttributeMapping;
|
||||
import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.ConvertedBasicType;
|
||||
import org.hibernate.type.SqlTypes;
|
||||
import org.hibernate.type.descriptor.converter.spi.BasicValueConverter;
|
||||
import org.hibernate.type.descriptor.converter.spi.JpaAttributeConverter;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
|
||||
import org.hibernate.type.internal.BasicTypeImpl;
|
||||
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.ServiceRegistry;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||
import org.hibernate.type.internal.BasicTypeImpl;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -71,10 +70,6 @@ public class SmokeTests {
|
|||
final JdbcTypeRegistry jdbcTypeRegistry = entityDescriptor.getFactory()
|
||||
.getTypeConfiguration()
|
||||
.getJdbcTypeRegistry();
|
||||
final NationalizationSupport nationalizationSupport = scope.getSessionFactory()
|
||||
.getJdbcServices()
|
||||
.getDialect()
|
||||
.getNationalizationSupport();
|
||||
|
||||
final EntityIdentifierMapping identifierMapping = entityDescriptor.getIdentifierMapping();
|
||||
assertThat(
|
||||
|
@ -127,7 +122,7 @@ public class SmokeTests {
|
|||
|
||||
assertThat(
|
||||
jdbcMapping.getJdbcType().getJdbcTypeCode(),
|
||||
isOneOf( SqlTypes.ENUM, nationalizationSupport.getVarcharVariantCode() )
|
||||
isOneOf( SqlTypes.ENUM, jdbcTypeRegistry.getDescriptor( SqlTypes.VARCHAR ).getJdbcTypeCode() )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue