Cleanup the naming of JavaDescriptor and JavaTypeDescriptor to align with the new naming JavaType
This commit is contained in:
parent
895ac83537
commit
445cedfec7
|
@ -20,7 +20,7 @@ import org.hibernate.cfg.AvailableSettings;
|
|||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.jpa.boot.spi.Bootstrap;
|
||||
import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase;
|
||||
import org.hibernate.type.descriptor.java.JdbcTimestampJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.JdbcTimestampJavaType;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -142,7 +142,7 @@ public class MapKeyTypeTest extends BaseEntityManagerFunctionalTestCase {
|
|||
@MapKeyJdbcTypeCode(Types.BIGINT)
|
||||
// todo (6.0) : figure out why `@MapKeyTemporal` did not work. imo it should
|
||||
// @MapKeyTemporal(TemporalType.TIMESTAMP)
|
||||
@MapKeyJavaType(JdbcTimestampJavaTypeDescriptor.class)
|
||||
@MapKeyJavaType(JdbcTimestampJavaType.class)
|
||||
@MapKeyColumn(name = "call_timestamp_epoch")
|
||||
@Column(name = "phone_number")
|
||||
private Map<Date, Integer> callRegister = new HashMap<>();
|
||||
|
|
|
@ -43,15 +43,15 @@ public class BigDecimalMappingTests {
|
|||
final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
|
||||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(EntityOfBigDecimals.class);
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
|
||||
.getJdbcTypeDescriptorRegistry();
|
||||
.getJdbcTypeRegistry();
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("wrapper");
|
||||
assertThat(attribute.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(BigDecimal.class));
|
||||
assertThat( attribute.getJavaType().getJavaTypeClass(), equalTo( BigDecimal.class));
|
||||
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(BigDecimal.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), is(jdbcTypeRegistry.getDescriptor(Types.NUMERIC)));
|
||||
assertThat( jdbcMapping.getJdbcType(), is( jdbcTypeRegistry.getDescriptor( Types.NUMERIC)));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -43,15 +43,15 @@ public class BigIntegerMappingTests {
|
|||
final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
|
||||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(EntityOfBigIntegers.class);
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
|
||||
.getJdbcTypeDescriptorRegistry();
|
||||
.getJdbcTypeRegistry();
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("wrapper");
|
||||
assertThat(attribute.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(BigInteger.class));
|
||||
assertThat( attribute.getJavaType().getJavaTypeClass(), equalTo( BigInteger.class));
|
||||
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(BigInteger.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), is(jdbcTypeRegistry.getDescriptor(Types.NUMERIC)));
|
||||
assertThat( jdbcMapping.getJdbcType(), is( jdbcTypeRegistry.getDescriptor( Types.NUMERIC)));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public class BooleanMappingTests {
|
|||
final JdbcMapping jdbcMapping = implicit.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaType(), equalTo(Boolean.class));
|
||||
assertThat(
|
||||
jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(),
|
||||
jdbcMapping.getJdbcType().getJdbcTypeCode(),
|
||||
// the implicit mapping will depend on the Dialect
|
||||
isOneOf(Types.BOOLEAN, Types.BIT, Types.TINYINT)
|
||||
);
|
||||
|
@ -61,7 +61,7 @@ public class BooleanMappingTests {
|
|||
final JdbcMapping jdbcMapping = convertedYesNo.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaType(), equalTo(Character.class));
|
||||
assertThat(
|
||||
jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(),
|
||||
jdbcMapping.getJdbcType().getJdbcTypeCode(),
|
||||
// could be NCHAR if nationalization is globally enabled
|
||||
isOneOf(Types.CHAR, Types.NCHAR)
|
||||
);
|
||||
|
@ -72,7 +72,7 @@ public class BooleanMappingTests {
|
|||
final JdbcMapping jdbcMapping = convertedTrueFalse.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaType(), equalTo(Character.class));
|
||||
assertThat(
|
||||
jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(),
|
||||
jdbcMapping.getJdbcType().getJdbcTypeCode(),
|
||||
// could be NCHAR if nationalization is globally enabled
|
||||
isOneOf(Types.CHAR, Types.NCHAR)
|
||||
);
|
||||
|
@ -83,7 +83,7 @@ public class BooleanMappingTests {
|
|||
final JdbcMapping jdbcMapping = convertedNumeric.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaType(), equalTo(Integer.class));
|
||||
assertThat(
|
||||
jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(),
|
||||
jdbcMapping.getJdbcType().getJdbcTypeCode(),
|
||||
equalTo(Types.INTEGER)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -42,28 +42,28 @@ public class ByteArrayMappingTests {
|
|||
final BasicAttributeMapping primitive = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("primitive");
|
||||
final JdbcMapping jdbcMapping = primitive.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(byte[].class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(), equalTo(Types.VARBINARY));
|
||||
assertThat( jdbcMapping.getJdbcType().getJdbcTypeCode(), equalTo( Types.VARBINARY));
|
||||
}
|
||||
|
||||
{
|
||||
final BasicAttributeMapping primitive = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("wrapper");
|
||||
final JdbcMapping jdbcMapping = primitive.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Byte[].class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(), equalTo(Types.VARBINARY));
|
||||
assertThat( jdbcMapping.getJdbcType().getJdbcTypeCode(), equalTo( Types.VARBINARY));
|
||||
}
|
||||
|
||||
{
|
||||
final BasicAttributeMapping primitive = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("primitiveLob");
|
||||
final JdbcMapping jdbcMapping = primitive.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(byte[].class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(), equalTo(Types.BLOB));
|
||||
assertThat( jdbcMapping.getJdbcType().getJdbcTypeCode(), equalTo( Types.BLOB));
|
||||
}
|
||||
|
||||
{
|
||||
final BasicAttributeMapping primitive = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("wrapperLob");
|
||||
final JdbcMapping jdbcMapping = primitive.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Byte[].class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(), equalTo(Types.BLOB));
|
||||
assertThat( jdbcMapping.getJdbcType().getJdbcTypeCode(), equalTo( Types.BLOB));
|
||||
}
|
||||
|
||||
scope.inTransaction(
|
||||
|
|
|
@ -42,24 +42,24 @@ public class ByteMappingTests {
|
|||
final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
|
||||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(EntityOfBytes.class);
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
|
||||
.getJdbcTypeDescriptorRegistry();
|
||||
.getJdbcTypeRegistry();
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("wrapper");
|
||||
assertThat(attribute.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Byte.class));
|
||||
assertThat( attribute.getJavaType().getJavaTypeClass(), equalTo( Byte.class));
|
||||
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Byte.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), is(jdbcTypeRegistry.getDescriptor(Types.TINYINT)));
|
||||
assertThat( jdbcMapping.getJdbcType(), is( jdbcTypeRegistry.getDescriptor( Types.TINYINT)));
|
||||
}
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("primitive");
|
||||
assertThat(attribute.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Byte.class));
|
||||
assertThat( attribute.getJavaType().getJavaTypeClass(), equalTo( Byte.class));
|
||||
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Byte.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), is(jdbcTypeRegistry.getDescriptor(Types.TINYINT)));
|
||||
assertThat( jdbcMapping.getJdbcType(), is( jdbcTypeRegistry.getDescriptor( Types.TINYINT)));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import jakarta.persistence.Id;
|
|||
import jakarta.persistence.Lob;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Nationalized;
|
||||
import org.hibernate.metamodel.MappingMetamodel;
|
||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||
import org.hibernate.metamodel.mapping.internal.BasicAttributeMapping;
|
||||
|
@ -36,32 +35,32 @@ public class CharacterArrayMappingTests {
|
|||
@Test
|
||||
public void verifyMappings(SessionFactoryScope scope) {
|
||||
final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
|
||||
final JdbcTypeRegistry jdbcRegistry = domainModel.getTypeConfiguration().getJdbcTypeDescriptorRegistry();
|
||||
final JdbcTypeRegistry jdbcRegistry = domainModel.getTypeConfiguration().getJdbcTypeRegistry();
|
||||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(EntityWithCharArrays.class);
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attributeMapping = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("primitive");
|
||||
final JdbcMapping jdbcMapping = attributeMapping.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), equalTo(jdbcRegistry.getDescriptor(Types.VARCHAR)));
|
||||
assertThat( jdbcMapping.getJdbcType(), equalTo( jdbcRegistry.getDescriptor( Types.VARCHAR)));
|
||||
}
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attributeMapping = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("wrapper");
|
||||
final JdbcMapping jdbcMapping = attributeMapping.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), equalTo(jdbcRegistry.getDescriptor(Types.VARCHAR)));
|
||||
assertThat( jdbcMapping.getJdbcType(), equalTo( jdbcRegistry.getDescriptor( Types.VARCHAR)));
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attributeMapping = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("primitiveClob");
|
||||
final JdbcMapping jdbcMapping = attributeMapping.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), equalTo(jdbcRegistry.getDescriptor(Types.CLOB)));
|
||||
assertThat( jdbcMapping.getJdbcType(), equalTo( jdbcRegistry.getDescriptor( Types.CLOB)));
|
||||
}
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attributeMapping = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("wrapperClob");
|
||||
final JdbcMapping jdbcMapping = attributeMapping.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), equalTo(jdbcRegistry.getDescriptor(Types.CLOB)));
|
||||
assertThat( jdbcMapping.getJdbcType(), equalTo( jdbcRegistry.getDescriptor( Types.CLOB)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class CharacterArrayNationalizedMappingTests {
|
|||
final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
|
||||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(EntityWithCharArrays.class);
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
|
||||
.getJdbcTypeDescriptorRegistry();
|
||||
.getJdbcTypeRegistry();
|
||||
|
||||
final Dialect dialect = scope.getSessionFactory().getJdbcServices().getDialect();
|
||||
final NationalizationSupport nationalizationSupport = dialect.getNationalizationSupport();
|
||||
|
@ -52,26 +52,26 @@ public class CharacterArrayNationalizedMappingTests {
|
|||
{
|
||||
final BasicAttributeMapping attributeMapping = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("primitiveNVarchar");
|
||||
final JdbcMapping jdbcMapping = attributeMapping.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), is(jdbcTypeRegistry.getDescriptor(nationalizationSupport.getVarcharVariantCode())));
|
||||
assertThat( jdbcMapping.getJdbcType(), is( jdbcTypeRegistry.getDescriptor( nationalizationSupport.getVarcharVariantCode())));
|
||||
}
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attributeMapping = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("wrapperNVarchar");
|
||||
final JdbcMapping jdbcMapping = attributeMapping.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), is(jdbcTypeRegistry.getDescriptor(nationalizationSupport.getVarcharVariantCode())));
|
||||
assertThat( jdbcMapping.getJdbcType(), is( jdbcTypeRegistry.getDescriptor( nationalizationSupport.getVarcharVariantCode())));
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attributeMapping = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("primitiveNClob");
|
||||
final JdbcMapping jdbcMapping = attributeMapping.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), is(jdbcTypeRegistry.getDescriptor(nationalizationSupport.getClobVariantCode())));
|
||||
assertThat( jdbcMapping.getJdbcType(), is( jdbcTypeRegistry.getDescriptor( nationalizationSupport.getClobVariantCode())));
|
||||
}
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attributeMapping = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("wrapperNClob");
|
||||
final JdbcMapping jdbcMapping = attributeMapping.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), is(jdbcTypeRegistry.getDescriptor(nationalizationSupport.getClobVariantCode())));
|
||||
assertThat( jdbcMapping.getJdbcType(), is( jdbcTypeRegistry.getDescriptor( nationalizationSupport.getClobVariantCode())));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,11 +23,8 @@ import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
|||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.hamcrest.Matchers;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.isOneOf;
|
||||
|
||||
/**
|
||||
* Tests for mapping `double` values
|
||||
|
@ -42,25 +39,25 @@ public class CharacterMappingTests {
|
|||
public void testMappings(SessionFactoryScope scope) {
|
||||
// first, verify the type selections...
|
||||
final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
|
||||
final JdbcTypeRegistry jdbcRegistry = domainModel.getTypeConfiguration().getJdbcTypeDescriptorRegistry();
|
||||
final JdbcTypeRegistry jdbcRegistry = domainModel.getTypeConfiguration().getJdbcTypeRegistry();
|
||||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(EntityOfCharacters.class);
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("wrapper");
|
||||
assertThat(attribute.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Character.class));
|
||||
assertThat( attribute.getJavaType().getJavaTypeClass(), equalTo( Character.class));
|
||||
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Character.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), equalTo(jdbcRegistry.getDescriptor(Types.CHAR)));
|
||||
assertThat( jdbcMapping.getJdbcType(), equalTo( jdbcRegistry.getDescriptor( Types.CHAR)));
|
||||
}
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("primitive");
|
||||
assertThat(attribute.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Character.class));
|
||||
assertThat( attribute.getJavaType().getJavaTypeClass(), equalTo( Character.class));
|
||||
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Character.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), equalTo(jdbcRegistry.getDescriptor(Types.CHAR)));
|
||||
assertThat( jdbcMapping.getJdbcType(), equalTo( jdbcRegistry.getDescriptor( Types.CHAR)));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
package org.hibernate.userguide.mapping.basic;
|
||||
|
||||
import java.sql.Types;
|
||||
import java.time.ZoneOffset;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
@ -36,13 +36,13 @@ public class ClassMappingTests {
|
|||
@Test
|
||||
public void verifyMappings(SessionFactoryScope scope) {
|
||||
final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
|
||||
final JdbcTypeRegistry jdbcRegistry = domainModel.getTypeConfiguration().getJdbcTypeDescriptorRegistry();
|
||||
final JdbcTypeRegistry jdbcRegistry = domainModel.getTypeConfiguration().getJdbcTypeRegistry();
|
||||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(EntityWithClass.class);
|
||||
|
||||
final BasicAttributeMapping duration = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("clazz");
|
||||
final JdbcMapping jdbcMapping = duration.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Class.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), equalTo(jdbcRegistry.getDescriptor(Types.VARCHAR)));
|
||||
assertThat( jdbcMapping.getJdbcType(), equalTo( jdbcRegistry.getDescriptor( Types.VARCHAR)));
|
||||
|
||||
scope.inTransaction(
|
||||
(session) -> {
|
||||
|
|
|
@ -36,13 +36,13 @@ public class CurrencyMappingTests {
|
|||
@Test
|
||||
public void verifyMappings(SessionFactoryScope scope) {
|
||||
final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
|
||||
final JdbcTypeRegistry jdbcRegistry = domainModel.getTypeConfiguration().getJdbcTypeDescriptorRegistry();
|
||||
final JdbcTypeRegistry jdbcRegistry = domainModel.getTypeConfiguration().getJdbcTypeRegistry();
|
||||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(EntityWithCurrency.class);
|
||||
|
||||
final BasicAttributeMapping duration = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("currency");
|
||||
final JdbcMapping jdbcMapping = duration.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Currency.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), equalTo(jdbcRegistry.getDescriptor(Types.VARCHAR)));
|
||||
assertThat( jdbcMapping.getJdbcType(), equalTo( jdbcRegistry.getDescriptor( Types.VARCHAR)));
|
||||
|
||||
scope.inTransaction(
|
||||
(session) -> {
|
||||
|
|
|
@ -26,12 +26,12 @@ public class CustomBinaryJdbcType implements JdbcType {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <X> ValueBinder<X> getBinder(JavaType<X> javaTypeDescriptor) {
|
||||
return VarbinaryJdbcType.INSTANCE.getBinder(javaTypeDescriptor);
|
||||
public <X> ValueBinder<X> getBinder(JavaType<X> javaType) {
|
||||
return VarbinaryJdbcType.INSTANCE.getBinder( javaType );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> ValueExtractor<X> getExtractor(JavaType<X> javaTypeDescriptor) {
|
||||
return VarbinaryJdbcType.INSTANCE.getExtractor(javaTypeDescriptor);
|
||||
public <X> ValueExtractor<X> getExtractor(JavaType<X> javaType) {
|
||||
return VarbinaryJdbcType.INSTANCE.getExtractor( javaType );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.hibernate.metamodel.MappingMetamodel;
|
|||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||
import org.hibernate.metamodel.mapping.internal.BasicAttributeMapping;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.type.descriptor.java.TemporalJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.TemporalJavaType;
|
||||
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
|
@ -45,31 +45,31 @@ public class DatePrecisionTests {
|
|||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("dateAsTimestamp");
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
final TemporalJavaTypeDescriptor jtd = (TemporalJavaTypeDescriptor) jdbcMapping.getJavaTypeDescriptor();
|
||||
assertThat(jtd, is(attribute.getJavaTypeDescriptor()));
|
||||
final TemporalJavaType jtd = (TemporalJavaType) jdbcMapping.getJavaTypeDescriptor();
|
||||
assertThat(jtd, is(attribute.getJavaType()));
|
||||
assertThat(jtd.getJavaTypeClass(), equalTo(Timestamp.class));
|
||||
assertThat(jtd.getPrecision(), equalTo(TemporalType.TIMESTAMP));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(), equalTo(Types.TIMESTAMP));
|
||||
assertThat( jdbcMapping.getJdbcType().getJdbcTypeCode(), equalTo( Types.TIMESTAMP));
|
||||
}
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("dateAsDate");
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
final TemporalJavaTypeDescriptor jtd = (TemporalJavaTypeDescriptor) jdbcMapping.getJavaTypeDescriptor();
|
||||
assertThat(jtd, is(attribute.getJavaTypeDescriptor()));
|
||||
final TemporalJavaType jtd = (TemporalJavaType) jdbcMapping.getJavaTypeDescriptor();
|
||||
assertThat(jtd, is(attribute.getJavaType()));
|
||||
assertThat(jtd.getJavaTypeClass(), equalTo(java.sql.Date.class));
|
||||
assertThat(jtd.getPrecision(), equalTo(TemporalType.DATE));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(), equalTo(Types.DATE));
|
||||
assertThat( jdbcMapping.getJdbcType().getJdbcTypeCode(), equalTo( Types.DATE));
|
||||
}
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("dateAsTime");
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
final TemporalJavaTypeDescriptor jtd = (TemporalJavaTypeDescriptor) jdbcMapping.getJavaTypeDescriptor();
|
||||
assertThat(jtd, is(attribute.getJavaTypeDescriptor()));
|
||||
final TemporalJavaType jtd = (TemporalJavaType) jdbcMapping.getJavaTypeDescriptor();
|
||||
assertThat(jtd, is(attribute.getJavaType()));
|
||||
assertThat(jtd.getJavaTypeClass(), equalTo(Time.class));
|
||||
assertThat(jtd.getPrecision(), equalTo(TemporalType.TIME));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(), equalTo(Types.TIME));
|
||||
assertThat( jdbcMapping.getJdbcType().getJdbcTypeCode(), equalTo( Types.TIME));
|
||||
}
|
||||
|
||||
// check persistence operations
|
||||
|
|
|
@ -44,24 +44,24 @@ public class DoubleMappingTests {
|
|||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("wrapper");
|
||||
assertThat(attribute.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Double.class));
|
||||
assertThat( attribute.getJavaType().getJavaTypeClass(), equalTo( Double.class));
|
||||
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Double.class));
|
||||
assertThat(
|
||||
jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(),
|
||||
jdbcMapping.getJdbcType().getJdbcTypeCode(),
|
||||
isOneOf(Types.DOUBLE, Types.FLOAT, Types.REAL, Types.NUMERIC)
|
||||
);
|
||||
}
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("primitive");
|
||||
assertThat(attribute.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Double.class));
|
||||
assertThat( attribute.getJavaType().getJavaTypeClass(), equalTo( Double.class));
|
||||
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Double.class));
|
||||
assertThat(
|
||||
jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(),
|
||||
jdbcMapping.getJdbcType().getJdbcTypeCode(),
|
||||
isOneOf(Types.DOUBLE, Types.FLOAT, Types.REAL, Types.NUMERIC)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class DurationMappingTests {
|
|||
final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
|
||||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(EntityWithDuration.class);
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
|
||||
.getJdbcTypeDescriptorRegistry();
|
||||
.getJdbcTypeRegistry();
|
||||
|
||||
final BasicAttributeMapping duration = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("duration");
|
||||
final JdbcMapping jdbcMapping = duration.getJdbcMapping();
|
||||
|
@ -57,7 +57,7 @@ public class DurationMappingTests {
|
|||
else {
|
||||
realType = intervalType;
|
||||
}
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), is(realType));
|
||||
assertThat( jdbcMapping.getJdbcType(), is( realType));
|
||||
|
||||
scope.inTransaction(
|
||||
(session) -> {
|
||||
|
|
|
@ -43,24 +43,24 @@ public class FloatMappingTests {
|
|||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("wrapper");
|
||||
assertThat(attribute.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Float.class));
|
||||
assertThat( attribute.getJavaType().getJavaTypeClass(), equalTo( Float.class));
|
||||
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Float.class));
|
||||
assertThat(
|
||||
jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(),
|
||||
jdbcMapping.getJdbcType().getJdbcTypeCode(),
|
||||
isOneOf(Types.FLOAT, Types.REAL, Types.NUMERIC)
|
||||
);
|
||||
}
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("primitive");
|
||||
assertThat(attribute.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Float.class));
|
||||
assertThat( attribute.getJavaType().getJavaTypeClass(), equalTo( Float.class));
|
||||
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Float.class));
|
||||
assertThat(
|
||||
jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(),
|
||||
jdbcMapping.getJdbcType().getJdbcTypeCode(),
|
||||
isOneOf(Types.FLOAT, Types.REAL, Types.NUMERIC)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
package org.hibernate.userguide.mapping.basic;
|
||||
|
||||
import org.hibernate.type.descriptor.WrapperOptions;
|
||||
import org.hibernate.type.descriptor.java.AbstractClassJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.CharacterJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.AbstractClassJavaType;
|
||||
import org.hibernate.type.descriptor.java.CharacterJavaType;
|
||||
|
||||
/**
|
||||
* @author Vlad Mihalcea
|
||||
*/
|
||||
//tag::basic-enums-custom-type-example[]
|
||||
public class GenderJavaTypeDescriptor extends AbstractClassJavaTypeDescriptor<Gender> {
|
||||
public class GenderJavaType extends AbstractClassJavaType<Gender> {
|
||||
|
||||
public static final GenderJavaTypeDescriptor INSTANCE =
|
||||
new GenderJavaTypeDescriptor();
|
||||
public static final GenderJavaType INSTANCE =
|
||||
new GenderJavaType();
|
||||
|
||||
protected GenderJavaTypeDescriptor() {
|
||||
protected GenderJavaType() {
|
||||
super(Gender.class);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ public class GenderJavaTypeDescriptor extends AbstractClassJavaTypeDescriptor<Ge
|
|||
}
|
||||
|
||||
public <X> X unwrap(Gender value, Class<X> type, WrapperOptions options) {
|
||||
return CharacterJavaTypeDescriptor.INSTANCE.unwrap(
|
||||
return CharacterJavaType.INSTANCE.unwrap(
|
||||
value == null ? null : value.getCode(),
|
||||
type,
|
||||
options
|
||||
|
@ -35,7 +35,7 @@ public class GenderJavaTypeDescriptor extends AbstractClassJavaTypeDescriptor<Ge
|
|||
|
||||
public <X> Gender wrap(X value, WrapperOptions options) {
|
||||
return Gender.fromCode(
|
||||
CharacterJavaTypeDescriptor.INSTANCE.wrap(value, options)
|
||||
CharacterJavaType.INSTANCE.wrap( value, options)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -7,7 +7,6 @@
|
|||
package org.hibernate.userguide.mapping.basic;
|
||||
|
||||
import java.sql.Types;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
|
@ -41,7 +40,7 @@ public class InstantMappingTests {
|
|||
final BasicAttributeMapping duration = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("instant");
|
||||
final JdbcMapping jdbcMapping = duration.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Instant.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(), equalTo(Types.TIMESTAMP));
|
||||
assertThat( jdbcMapping.getJdbcType().getJdbcTypeCode(), equalTo( Types.TIMESTAMP));
|
||||
|
||||
scope.inTransaction(
|
||||
(session) -> {
|
||||
|
|
|
@ -43,20 +43,20 @@ public class IntegerMappingTests {
|
|||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("wrapper");
|
||||
assertThat(attribute.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Integer.class));
|
||||
assertThat( attribute.getJavaType().getJavaTypeClass(), equalTo( Integer.class));
|
||||
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Integer.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(), is(Types.INTEGER));
|
||||
assertThat( jdbcMapping.getJdbcType().getJdbcTypeCode(), is( Types.INTEGER));
|
||||
}
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("primitive");
|
||||
assertThat(attribute.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Integer.class));
|
||||
assertThat( attribute.getJavaType().getJavaTypeClass(), equalTo( Integer.class));
|
||||
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Integer.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(), is(Types.INTEGER));
|
||||
assertThat( jdbcMapping.getJdbcType().getJdbcTypeCode(), is( Types.INTEGER));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
package org.hibernate.userguide.mapping.basic;
|
||||
|
||||
import java.sql.Types;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
|
@ -41,7 +40,7 @@ public class LocalDateMappingTests {
|
|||
final BasicAttributeMapping duration = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("localDate");
|
||||
final JdbcMapping jdbcMapping = duration.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(LocalDate.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(), equalTo(Types.DATE));
|
||||
assertThat( jdbcMapping.getJdbcType().getJdbcTypeCode(), equalTo( Types.DATE));
|
||||
|
||||
scope.inTransaction(
|
||||
(session) -> {
|
||||
|
|
|
@ -40,7 +40,7 @@ public class LocalDateTimeMappingTests {
|
|||
final BasicAttributeMapping duration = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("localDateTime");
|
||||
final JdbcMapping jdbcMapping = duration.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(LocalDateTime.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(), equalTo(Types.TIMESTAMP));
|
||||
assertThat( jdbcMapping.getJdbcType().getJdbcTypeCode(), equalTo( Types.TIMESTAMP));
|
||||
|
||||
scope.inTransaction(
|
||||
(session) -> {
|
||||
|
|
|
@ -41,7 +41,7 @@ public class LocalTimeMappingTests {
|
|||
final BasicAttributeMapping duration = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("localTime");
|
||||
final JdbcMapping jdbcMapping = duration.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(LocalTime.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(), equalTo(Types.TIME));
|
||||
assertThat( jdbcMapping.getJdbcType().getJdbcTypeCode(), equalTo( Types.TIME));
|
||||
|
||||
scope.inTransaction(
|
||||
(session) -> {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
package org.hibernate.userguide.mapping.basic;
|
||||
|
||||
import java.sql.Types;
|
||||
import java.util.Currency;
|
||||
import java.util.Locale;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
|
@ -37,13 +36,13 @@ public class LocaleMappingTests {
|
|||
@Test
|
||||
public void verifyMappings(SessionFactoryScope scope) {
|
||||
final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
|
||||
final JdbcTypeRegistry jdbcRegistry = domainModel.getTypeConfiguration().getJdbcTypeDescriptorRegistry();
|
||||
final JdbcTypeRegistry jdbcRegistry = domainModel.getTypeConfiguration().getJdbcTypeRegistry();
|
||||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(EntityWithLocale.class);
|
||||
|
||||
final BasicAttributeMapping duration = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("locale");
|
||||
final JdbcMapping jdbcMapping = duration.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Locale.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), equalTo(jdbcRegistry.getDescriptor(Types.VARCHAR)));
|
||||
assertThat( jdbcMapping.getJdbcType(), equalTo( jdbcRegistry.getDescriptor( Types.VARCHAR)));
|
||||
|
||||
scope.inTransaction(
|
||||
(session) -> {
|
||||
|
|
|
@ -43,20 +43,20 @@ public class LongMappingTests {
|
|||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("wrapper");
|
||||
assertThat(attribute.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Long.class));
|
||||
assertThat( attribute.getJavaType().getJavaTypeClass(), equalTo( Long.class));
|
||||
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Long.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(), is(Types.BIGINT));
|
||||
assertThat( jdbcMapping.getJdbcType().getJdbcTypeCode(), is( Types.BIGINT));
|
||||
}
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("primitive");
|
||||
assertThat(attribute.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Long.class));
|
||||
assertThat( attribute.getJavaType().getJavaTypeClass(), equalTo( Long.class));
|
||||
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Long.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(), is(Types.BIGINT));
|
||||
assertThat( jdbcMapping.getJdbcType().getJdbcTypeCode(), is( Types.BIGINT));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,9 +7,8 @@
|
|||
package org.hibernate.userguide.mapping.basic;
|
||||
|
||||
import java.sql.Types;
|
||||
import java.time.LocalTime;
|
||||
import java.time.OffsetDateTime;
|
||||
import jakarta.persistence.Column;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
@ -43,7 +42,7 @@ public class OffsetDateTimeMappingTests {
|
|||
final BasicAttributeMapping attributeMapping = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("offsetDateTime");
|
||||
final JdbcMapping jdbcMapping = attributeMapping.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(OffsetDateTime.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(), isOneOf(Types.TIMESTAMP, Types.TIMESTAMP_WITH_TIMEZONE));
|
||||
assertThat( jdbcMapping.getJdbcType().getJdbcTypeCode(), isOneOf( Types.TIMESTAMP, Types.TIMESTAMP_WITH_TIMEZONE));
|
||||
|
||||
scope.inTransaction(
|
||||
(session) -> {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
package org.hibernate.userguide.mapping.basic;
|
||||
|
||||
import java.sql.Types;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.OffsetTime;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
|
@ -42,7 +41,7 @@ public class OffsetTimeMappingTests {
|
|||
final BasicAttributeMapping attributeMapping = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("offsetTime");
|
||||
final JdbcMapping jdbcMapping = attributeMapping.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(OffsetTime.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(), isOneOf(Types.TIME, Types.TIME_WITH_TIMEZONE));
|
||||
assertThat( jdbcMapping.getJdbcType().getJdbcTypeCode(), isOneOf( Types.TIME, Types.TIME_WITH_TIMEZONE));
|
||||
|
||||
scope.inTransaction(
|
||||
(session) -> {
|
||||
|
|
|
@ -43,20 +43,20 @@ public class ShortMappingTests {
|
|||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("wrapper");
|
||||
assertThat(attribute.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Short.class));
|
||||
assertThat( attribute.getJavaType().getJavaTypeClass(), equalTo( Short.class));
|
||||
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Short.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(), is(Types.SMALLINT));
|
||||
assertThat( jdbcMapping.getJdbcType().getJdbcTypeCode(), is( Types.SMALLINT));
|
||||
}
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("primitive");
|
||||
assertThat(attribute.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Short.class));
|
||||
assertThat( attribute.getJavaType().getJavaTypeClass(), equalTo( Short.class));
|
||||
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(Short.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(), is(Types.SMALLINT));
|
||||
assertThat( jdbcMapping.getJdbcType().getJdbcTypeCode(), is( Types.SMALLINT));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,23 +40,23 @@ public class StringMappingTests {
|
|||
public void testMappings(SessionFactoryScope scope) {
|
||||
// first, verify the type selections...
|
||||
final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
|
||||
final JdbcTypeRegistry jdbcRegistry = domainModel.getTypeConfiguration().getJdbcTypeDescriptorRegistry();
|
||||
final JdbcTypeRegistry jdbcRegistry = domainModel.getTypeConfiguration().getJdbcTypeRegistry();
|
||||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(EntityOfStrings.class);
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("string");
|
||||
assertThat(attribute.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(String.class));
|
||||
assertThat( attribute.getJavaType().getJavaTypeClass(), equalTo( String.class));
|
||||
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(String.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), equalTo(jdbcRegistry.getDescriptor(Types.VARCHAR)));
|
||||
assertThat( jdbcMapping.getJdbcType(), equalTo( jdbcRegistry.getDescriptor( Types.VARCHAR)));
|
||||
}
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("clobString");
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(String.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), equalTo(jdbcRegistry.getDescriptor(Types.CLOB)));
|
||||
assertThat( jdbcMapping.getJdbcType(), equalTo( jdbcRegistry.getDescriptor( Types.CLOB)));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public class StringNationalizedMappingTests {
|
|||
final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
|
||||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(EntityOfStrings.class);
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
|
||||
.getJdbcTypeDescriptorRegistry();
|
||||
.getJdbcTypeRegistry();
|
||||
|
||||
final Dialect dialect = scope.getSessionFactory().getJdbcServices().getDialect();
|
||||
final NationalizationSupport nationalizationSupport = dialect.getNationalizationSupport();
|
||||
|
@ -54,14 +54,14 @@ public class StringNationalizedMappingTests {
|
|||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("nstring");
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(String.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), is(jdbcTypeRegistry.getDescriptor(nationalizationSupport.getVarcharVariantCode())));
|
||||
assertThat( jdbcMapping.getJdbcType(), is( jdbcTypeRegistry.getDescriptor( nationalizationSupport.getVarcharVariantCode())));
|
||||
}
|
||||
|
||||
{
|
||||
final BasicAttributeMapping attribute = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("nclobString");
|
||||
final JdbcMapping jdbcMapping = attribute.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(String.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), is(jdbcTypeRegistry.getDescriptor(nationalizationSupport.getClobVariantCode())));
|
||||
assertThat( jdbcMapping.getJdbcType(), is( jdbcTypeRegistry.getDescriptor( nationalizationSupport.getClobVariantCode())));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
package org.hibernate.userguide.mapping.basic;
|
||||
|
||||
import java.sql.Types;
|
||||
import java.time.Duration;
|
||||
import java.time.ZoneId;
|
||||
import java.util.TimeZone;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
|
@ -38,13 +36,13 @@ public class TimeZoneMappingTests {
|
|||
@Test
|
||||
public void verifyMappings(SessionFactoryScope scope) {
|
||||
final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
|
||||
final JdbcTypeRegistry jdbcRegistry = domainModel.getTypeConfiguration().getJdbcTypeDescriptorRegistry();
|
||||
final JdbcTypeRegistry jdbcRegistry = domainModel.getTypeConfiguration().getJdbcTypeRegistry();
|
||||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(EntityWithTimeZone.class);
|
||||
|
||||
final BasicAttributeMapping duration = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("timeZone");
|
||||
final JdbcMapping jdbcMapping = duration.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(TimeZone.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), equalTo(jdbcRegistry.getDescriptor(Types.VARCHAR)));
|
||||
assertThat( jdbcMapping.getJdbcType(), equalTo( jdbcRegistry.getDescriptor( Types.VARCHAR)));
|
||||
|
||||
scope.inTransaction(
|
||||
(session) -> {
|
||||
|
|
|
@ -8,7 +8,7 @@ package org.hibernate.userguide.mapping.basic;
|
|||
|
||||
import java.sql.Types;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
@ -37,13 +37,13 @@ public class ZoneOffsetMappingTests {
|
|||
@Test
|
||||
public void verifyMappings(SessionFactoryScope scope) {
|
||||
final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
|
||||
final JdbcTypeRegistry jdbcRegistry = domainModel.getTypeConfiguration().getJdbcTypeDescriptorRegistry();
|
||||
final JdbcTypeRegistry jdbcRegistry = domainModel.getTypeConfiguration().getJdbcTypeRegistry();
|
||||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(EntityWithZoneOffset.class);
|
||||
|
||||
final BasicAttributeMapping duration = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("zoneOffset");
|
||||
final JdbcMapping jdbcMapping = duration.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(ZoneOffset.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor(), equalTo(jdbcRegistry.getDescriptor(Types.VARCHAR)));
|
||||
assertThat( jdbcMapping.getJdbcType(), equalTo( jdbcRegistry.getDescriptor( Types.VARCHAR)));
|
||||
|
||||
scope.inTransaction(
|
||||
(session) -> {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
package org.hibernate.userguide.mapping.basic;
|
||||
|
||||
import java.sql.Types;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
|
@ -42,7 +41,7 @@ public class ZonedDateTimeMappingTests {
|
|||
final BasicAttributeMapping attributeMapping = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("zonedDateTime");
|
||||
final JdbcMapping jdbcMapping = attributeMapping.getJdbcMapping();
|
||||
assertThat(jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(ZonedDateTime.class));
|
||||
assertThat(jdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode(), isOneOf(Types.TIMESTAMP, Types.TIMESTAMP_WITH_TIMEZONE));
|
||||
assertThat( jdbcMapping.getJdbcType().getJdbcTypeCode(), isOneOf( Types.TIMESTAMP, Types.TIMESTAMP_WITH_TIMEZONE));
|
||||
|
||||
scope.inTransaction(
|
||||
(session) -> {
|
||||
|
|
|
@ -51,7 +51,7 @@ public class BitSetConverterImmutableTests {
|
|||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(Product.class);
|
||||
final BasicAttributeMapping attributeMapping = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("bitSet");
|
||||
|
||||
assertThat(attributeMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(BitSet.class));
|
||||
assertThat( attributeMapping.getJavaType().getJavaTypeClass(), equalTo( BitSet.class));
|
||||
|
||||
assertThat(attributeMapping.getValueConverter(), instanceOf(JpaAttributeConverter.class));
|
||||
final JpaAttributeConverter converter = (JpaAttributeConverter) attributeMapping.getValueConverter();
|
||||
|
@ -65,7 +65,7 @@ public class BitSetConverterImmutableTests {
|
|||
Assertions.assertThat(((MutabilityPlan) attributeMapping.getExposedMutabilityPlan()).deepCopy(sample)).isSameAs(sample);
|
||||
|
||||
assertThat(
|
||||
attributeMapping.getJdbcMapping().getJdbcTypeDescriptor().getJdbcTypeCode(),
|
||||
attributeMapping.getJdbcMapping().getJdbcType().getJdbcTypeCode(),
|
||||
isOneOf(Types.VARCHAR, Types.NVARCHAR)
|
||||
);
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public class BitSetConverterMutabilityTests {
|
|||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(Product.class);
|
||||
final BasicAttributeMapping attributeMapping = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("bitSet");
|
||||
|
||||
assertThat(attributeMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(BitSet.class));
|
||||
assertThat( attributeMapping.getJavaType().getJavaTypeClass(), equalTo( BitSet.class));
|
||||
|
||||
assertThat(attributeMapping.getValueConverter(), instanceOf(JpaAttributeConverter.class));
|
||||
final JpaAttributeConverter converter = (JpaAttributeConverter) attributeMapping.getValueConverter();
|
||||
|
@ -59,7 +59,7 @@ public class BitSetConverterMutabilityTests {
|
|||
Assertions.assertThat(attributeMapping.getExposedMutabilityPlan()).isInstanceOf(BitSetMutabilityPlan.class);
|
||||
|
||||
assertThat(
|
||||
attributeMapping.getJdbcMapping().getJdbcTypeDescriptor().getJdbcTypeCode(),
|
||||
attributeMapping.getJdbcMapping().getJdbcType().getJdbcTypeCode(),
|
||||
isOneOf(Types.VARCHAR, Types.NVARCHAR)
|
||||
);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public class BitSetConverterTests {
|
|||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(Product.class);
|
||||
final BasicAttributeMapping attributeMapping = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("bitSet");
|
||||
|
||||
assertThat(attributeMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(BitSet.class));
|
||||
assertThat( attributeMapping.getJavaType().getJavaTypeClass(), equalTo( BitSet.class));
|
||||
|
||||
assertThat(attributeMapping.getValueConverter(), instanceOf(JpaAttributeConverter.class));
|
||||
final JpaAttributeConverter converter = (JpaAttributeConverter) attributeMapping.getValueConverter();
|
||||
|
@ -56,7 +56,7 @@ public class BitSetConverterTests {
|
|||
Assertions.assertThat(attributeMapping.getExposedMutabilityPlan()).isNotInstanceOf(BitSetMutabilityPlan.class);
|
||||
|
||||
assertThat(
|
||||
attributeMapping.getJdbcMapping().getJdbcTypeDescriptor().getJdbcTypeCode(),
|
||||
attributeMapping.getJdbcMapping().getJdbcType().getJdbcTypeCode(),
|
||||
isOneOf(Types.VARCHAR, Types.NVARCHAR)
|
||||
);
|
||||
|
||||
|
|
|
@ -44,12 +44,12 @@ public class BitSetImplicitTests {
|
|||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(Product.class);
|
||||
final BasicAttributeMapping attributeMapping = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("bitSet");
|
||||
|
||||
assertThat(attributeMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(BitSet.class));
|
||||
assertThat( attributeMapping.getJavaType().getJavaTypeClass(), equalTo( BitSet.class));
|
||||
|
||||
assertThat(attributeMapping.getValueConverter(), nullValue());
|
||||
|
||||
assertThat(
|
||||
attributeMapping.getJdbcMapping().getJdbcTypeDescriptor().getJdbcTypeCode(),
|
||||
attributeMapping.getJdbcMapping().getJdbcType().getJdbcTypeCode(),
|
||||
is(Types.VARBINARY)
|
||||
);
|
||||
|
||||
|
|
|
@ -10,16 +10,16 @@ import java.sql.Types;
|
|||
import java.util.BitSet;
|
||||
|
||||
import org.hibernate.type.descriptor.WrapperOptions;
|
||||
import org.hibernate.type.descriptor.java.AbstractClassJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.AbstractClassJavaType;
|
||||
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||
|
||||
/**
|
||||
* @author Vlad Mihalcea
|
||||
*/
|
||||
//tag::basic-bitset-example-java-type[]
|
||||
public class BitSetJavaType extends AbstractClassJavaTypeDescriptor<BitSet> {
|
||||
public class BitSetJavaType extends AbstractClassJavaType<BitSet> {
|
||||
public static final BitSetJavaType INSTANCE = new BitSetJavaType();
|
||||
|
||||
public BitSetJavaType() {
|
||||
|
@ -32,9 +32,9 @@ public class BitSetJavaType extends AbstractClassJavaTypeDescriptor<BitSet> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public JdbcType getRecommendedJdbcType(JdbcTypeDescriptorIndicators indicators) {
|
||||
public JdbcType getRecommendedJdbcType(JdbcTypeIndicators indicators) {
|
||||
return indicators.getTypeConfiguration()
|
||||
.getJdbcTypeDescriptorRegistry()
|
||||
.getJdbcTypeRegistry()
|
||||
.getDescriptor(Types.VARCHAR);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ package org.hibernate.userguide.mapping.basic.bitset;
|
|||
|
||||
import java.util.BitSet;
|
||||
|
||||
import org.hibernate.annotations.JavaTypeRegistration;
|
||||
import org.hibernate.metamodel.mapping.SingularAttributeMapping;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
|
||||
|
@ -42,7 +41,7 @@ public class BitSetJavaTypeContributionTests {
|
|||
.findEntityDescriptor(Product.class);
|
||||
final SingularAttributeMapping bitSetAttribute = (SingularAttributeMapping) productType.findAttributeMapping("bitSet");
|
||||
// make sure BitSetTypeDescriptor was selected
|
||||
assertThat(bitSetAttribute.getJavaTypeDescriptor(), instanceOf(BitSetJavaType.class));
|
||||
assertThat( bitSetAttribute.getJavaType(), instanceOf( BitSetJavaType.class));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,6 +16,6 @@ import org.hibernate.service.ServiceRegistry;
|
|||
public class BitSetJavaTypeContributor implements TypeContributor {
|
||||
@Override
|
||||
public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
|
||||
typeContributions.contributeJavaTypeDescriptor(BitSetJavaType.INSTANCE);
|
||||
typeContributions.contributeJavaType( BitSetJavaType.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class BitSetJavaTypeRegistrationTests {
|
|||
.findEntityDescriptor(Product.class);
|
||||
final SingularAttributeMapping bitSetAttribute = (SingularAttributeMapping) productType.findAttributeMapping("bitSet");
|
||||
// make sure BitSetTypeDescriptor was selected
|
||||
assertThat(bitSetAttribute.getJavaTypeDescriptor(), instanceOf(BitSetJavaType.class));
|
||||
assertThat( bitSetAttribute.getJavaType(), instanceOf( BitSetJavaType.class));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ public class BitSetJavaTypeTests {
|
|||
.findEntityDescriptor(Product.class);
|
||||
final SingularAttributeMapping bitSetAttribute = (SingularAttributeMapping) productType.findAttributeMapping("bitSet");
|
||||
// make sure BitSetTypeDescriptor was selected
|
||||
assertThat(bitSetAttribute.getJavaTypeDescriptor(), instanceOf(BitSetJavaType.class));
|
||||
assertThat( bitSetAttribute.getJavaType(), instanceOf( BitSetJavaType.class));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -46,12 +46,12 @@ public class BitSetJdbcTypeCodeTests {
|
|||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(Product.class);
|
||||
final BasicAttributeMapping attributeMapping = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("bitSet");
|
||||
|
||||
assertThat(attributeMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(BitSet.class));
|
||||
assertThat( attributeMapping.getJavaType().getJavaTypeClass(), equalTo( BitSet.class));
|
||||
|
||||
assertThat(attributeMapping.getValueConverter(), nullValue());
|
||||
|
||||
assertThat(
|
||||
attributeMapping.getJdbcMapping().getJdbcTypeDescriptor().getJdbcTypeCode(),
|
||||
attributeMapping.getJdbcMapping().getJdbcType().getJdbcTypeCode(),
|
||||
is(Types.VARBINARY)
|
||||
);
|
||||
|
||||
|
|
|
@ -46,12 +46,12 @@ public class BitSetJdbcTypeRegistrationTests {
|
|||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(Product.class);
|
||||
final BasicAttributeMapping attributeMapping = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("bitSet");
|
||||
|
||||
assertThat(attributeMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(BitSet.class));
|
||||
assertThat( attributeMapping.getJavaType().getJavaTypeClass(), equalTo( BitSet.class));
|
||||
|
||||
assertThat(attributeMapping.getValueConverter(), nullValue());
|
||||
|
||||
assertThat(
|
||||
attributeMapping.getJdbcMapping().getJdbcTypeDescriptor().getJdbcTypeCode(),
|
||||
attributeMapping.getJdbcMapping().getJdbcType().getJdbcTypeCode(),
|
||||
is(Types.VARBINARY)
|
||||
);
|
||||
|
||||
|
|
|
@ -45,12 +45,12 @@ public class BitSetJdbcTypeTests {
|
|||
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor(Product.class);
|
||||
final BasicAttributeMapping attributeMapping = (BasicAttributeMapping) entityDescriptor.findAttributeMapping("bitSet");
|
||||
|
||||
assertThat(attributeMapping.getJavaTypeDescriptor().getJavaTypeClass(), equalTo(BitSet.class));
|
||||
assertThat( attributeMapping.getJavaType().getJavaTypeClass(), equalTo( BitSet.class));
|
||||
|
||||
assertThat(attributeMapping.getValueConverter(), nullValue());
|
||||
|
||||
assertThat(
|
||||
attributeMapping.getJdbcMapping().getJdbcTypeDescriptor().getJdbcTypeCode(),
|
||||
attributeMapping.getJdbcMapping().getJdbcType().getJdbcTypeCode(),
|
||||
is(Types.VARBINARY)
|
||||
);
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ logger.statistical-logging-session-event-listener.level=info
|
|||
|
||||
logger.model-binder.name=org.hibernate.boot.model.source.internal.hbm.ModelBinder
|
||||
logger.model-binder.level=debug
|
||||
logger.java-type-descriptor-registry.name=org.hibernate.type.descriptor.java.JavaTypeDescriptorRegistry
|
||||
logger.java-type-descriptor-registry.name=org.hibernate.type.descriptor.java.JavaTypeRegistry
|
||||
logger.java-type-descriptor-registry.level=debug
|
||||
|
||||
|
||||
|
|
|
@ -346,7 +346,7 @@ public class SQLiteDialect extends Dialect {
|
|||
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
|
||||
super.contributeTypes( typeContributions, serviceRegistry );
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
|
||||
.getJdbcTypeDescriptorRegistry();
|
||||
.getJdbcTypeRegistry();
|
||||
jdbcTypeRegistry.addDescriptor( Types.BLOB, BlobJdbcType.PRIMITIVE_ARRAY_BINDING );
|
||||
jdbcTypeRegistry.addDescriptor( Types.CLOB, ClobJdbcType.STRING_BINDING );
|
||||
}
|
||||
|
|
|
@ -19,9 +19,8 @@ import org.hibernate.query.sqm.function.SqmFunctionDescriptor;
|
|||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.sql.ast.spi.SqlAppender;
|
||||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.descriptor.java.DateJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.JdbcDateJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.JdbcTimestampJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.JdbcDateJavaType;
|
||||
import org.hibernate.type.descriptor.java.JdbcTimestampJavaType;
|
||||
import org.hibernate.type.descriptor.jdbc.DateJdbcType;
|
||||
import org.hibernate.type.descriptor.jdbc.TimestampJdbcType;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
@ -94,8 +93,8 @@ public class InformixDialectTestCase extends BaseUnitTestCase {
|
|||
new TypeConfiguration()
|
||||
);
|
||||
BasicType<?> basicType = (BasicType<?>) sqmExpression.getNodeType();
|
||||
assertEquals( JdbcTimestampJavaTypeDescriptor.INSTANCE, basicType.getJavaTypeDescriptor() );
|
||||
assertEquals( TimestampJdbcType.INSTANCE, basicType.getJdbcTypeDescriptor() );
|
||||
assertEquals( JdbcTimestampJavaType.INSTANCE, basicType.getJavaTypeDescriptor() );
|
||||
assertEquals( TimestampJdbcType.INSTANCE, basicType.getJdbcType() );
|
||||
|
||||
SqlAppender appender = new StringBuilderSqlAppender();
|
||||
sqmExpression.getRenderingSupport().render( appender, Collections.emptyList(), null );
|
||||
|
@ -113,8 +112,8 @@ public class InformixDialectTestCase extends BaseUnitTestCase {
|
|||
new TypeConfiguration()
|
||||
);
|
||||
BasicType<?> basicType = (BasicType<?>) sqmExpression.getNodeType();
|
||||
assertEquals( JdbcDateJavaTypeDescriptor.INSTANCE, basicType.getJavaTypeDescriptor() );
|
||||
assertEquals( DateJdbcType.INSTANCE, basicType.getJdbcTypeDescriptor() );
|
||||
assertEquals( JdbcDateJavaType.INSTANCE, basicType.getJavaTypeDescriptor() );
|
||||
assertEquals( DateJdbcType.INSTANCE, basicType.getJdbcType() );
|
||||
|
||||
SqlAppender appender = new StringBuilderSqlAppender();
|
||||
sqmExpression.getRenderingSupport().render( appender, Collections.emptyList(), null );
|
||||
|
|
|
@ -17,7 +17,7 @@ import static java.lang.annotation.ElementType.METHOD;
|
|||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
/**
|
||||
* Specify an explicit BasicJavaDescriptor to use for a particular
|
||||
* Specify an explicit BasicJavaType to use for a particular
|
||||
* column mapping. <ul>
|
||||
* <li>
|
||||
* When applied to a Map-valued attribute, describes the Map value. Use
|
||||
|
|
|
@ -18,7 +18,7 @@ import static java.lang.annotation.ElementType.TYPE;
|
|||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
/**
|
||||
* Registers the BasicJavaDescriptor to use for the given {@link #javaType}
|
||||
* Registers the BasicJavaType to use for the given {@link #javaType}
|
||||
*
|
||||
* Registrations applied to a package are processed before Hibernate begins to process
|
||||
* any attributes, etc.
|
||||
|
|
|
@ -57,7 +57,6 @@ import org.hibernate.boot.query.NamedProcedureCallDefinition;
|
|||
import org.hibernate.boot.query.NamedResultSetMappingDescriptor;
|
||||
import org.hibernate.boot.spi.BootstrapContext;
|
||||
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
||||
import org.hibernate.boot.spi.InFlightMetadataCollector.CollectionTypeRegistrationDescriptor;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.boot.spi.MetadataBuildingOptions;
|
||||
import org.hibernate.boot.spi.NaturalIdUniqueKeyBinder;
|
||||
|
@ -106,7 +105,6 @@ import org.hibernate.query.sqm.function.SqmFunctionDescriptor;
|
|||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
import org.hibernate.usertype.UserCollectionType;
|
||||
|
||||
import jakarta.persistence.AttributeConverter;
|
||||
import jakarta.persistence.Embeddable;
|
||||
|
@ -386,12 +384,12 @@ public class InFlightMetadataCollectorImpl implements InFlightMetadataCollector
|
|||
|
||||
@Override
|
||||
public void addJavaTypeRegistration(Class<?> javaType, JavaType<?> jtd) {
|
||||
getTypeConfiguration().getJavaTypeDescriptorRegistry().addBaselineDescriptor( javaType, jtd );
|
||||
getTypeConfiguration().getJavaTypeRegistry().addBaselineDescriptor( javaType, jtd );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addJdbcTypeRegistration(int typeCode, JdbcType jdbcType) {
|
||||
getTypeConfiguration().getJdbcTypeDescriptorRegistry().addDescriptor( typeCode, jdbcType );
|
||||
getTypeConfiguration().getJdbcTypeRegistry().addDescriptor( typeCode, jdbcType );
|
||||
}
|
||||
|
||||
private Map<Class<?>, Class<? extends EmbeddableInstantiator>> registeredInstantiators;
|
||||
|
|
|
@ -74,7 +74,6 @@ import org.hibernate.metamodel.CollectionClassification;
|
|||
import org.hibernate.query.sqm.function.SqmFunctionDescriptor;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.CustomType;
|
||||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
@ -298,13 +297,13 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont
|
|||
}
|
||||
|
||||
@Override
|
||||
public void contributeJavaTypeDescriptor(JavaType descriptor) {
|
||||
this.bootstrapContext.getTypeConfiguration().getJavaTypeDescriptorRegistry().addDescriptor( descriptor );
|
||||
public void contributeJavaType(JavaType<?> descriptor) {
|
||||
this.bootstrapContext.getTypeConfiguration().getJavaTypeRegistry().addDescriptor( descriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contributeJdbcTypeDescriptor(JdbcType descriptor) {
|
||||
this.bootstrapContext.getTypeConfiguration().getJdbcTypeDescriptorRegistry().addDescriptor( descriptor );
|
||||
public void contributeJdbcType(JdbcType descriptor) {
|
||||
this.bootstrapContext.getTypeConfiguration().getJdbcTypeRegistry().addDescriptor( descriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,16 +24,16 @@ public interface TypeContributions {
|
|||
TypeConfiguration getTypeConfiguration();
|
||||
|
||||
/**
|
||||
* Add the JavaTypeDescriptor to the {@link TypeConfiguration}'s
|
||||
* Add the JavaType to the {@link TypeConfiguration}'s
|
||||
* {@link JavaTypeRegistry}
|
||||
*/
|
||||
void contributeJavaTypeDescriptor(JavaType descriptor);
|
||||
void contributeJavaType(JavaType<?> descriptor);
|
||||
|
||||
/**
|
||||
* Add the JdbcType to the {@link TypeConfiguration}'s
|
||||
* {@link JdbcTypeRegistry}
|
||||
*/
|
||||
void contributeJdbcTypeDescriptor(JdbcType descriptor);
|
||||
void contributeJdbcType(JdbcType descriptor);
|
||||
|
||||
/**
|
||||
* Registers a UserType as the implicit (auto-applied) type
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
|
|||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
import org.hibernate.type.spi.TypeConfigurationAware;
|
||||
import org.hibernate.usertype.UserType;
|
||||
|
@ -99,7 +99,7 @@ public class TypeDefinition implements Serializable {
|
|||
Map localConfigParameters,
|
||||
MutabilityPlan explicitMutabilityPlan,
|
||||
MetadataBuildingContext context,
|
||||
JdbcTypeDescriptorIndicators indicators) {
|
||||
JdbcTypeIndicators indicators) {
|
||||
if ( CollectionHelper.isEmpty( localConfigParameters ) ) {
|
||||
// we can use the re-usable resolution...
|
||||
if ( reusableResolution == null ) {
|
||||
|
@ -117,7 +117,7 @@ public class TypeDefinition implements Serializable {
|
|||
private BasicValue.Resolution<?> createResolution(
|
||||
String name,
|
||||
Map<?,?> usageSiteProperties,
|
||||
JdbcTypeDescriptorIndicators indicators,
|
||||
JdbcTypeIndicators indicators,
|
||||
MetadataBuildingContext context) {
|
||||
return createResolution(
|
||||
name,
|
||||
|
@ -134,7 +134,7 @@ public class TypeDefinition implements Serializable {
|
|||
Class<?> typeImplementorClass,
|
||||
Properties parameters,
|
||||
Map<?,?> usageSiteProperties,
|
||||
JdbcTypeDescriptorIndicators indicators,
|
||||
JdbcTypeIndicators indicators,
|
||||
MetadataBuildingContext context) {
|
||||
final BootstrapContext bootstrapContext = context.getBootstrapContext();
|
||||
final TypeConfiguration typeConfiguration = bootstrapContext.getTypeConfiguration();
|
||||
|
@ -202,18 +202,18 @@ public class TypeDefinition implements Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public JavaType<Object> getDomainJavaDescriptor() {
|
||||
return resolvedBasicType.getMappedJavaTypeDescriptor();
|
||||
public JavaType<Object> getDomainJavaType() {
|
||||
return resolvedBasicType.getMappedJavaType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaType<?> getRelationalJavaDescriptor() {
|
||||
return resolvedBasicType.getMappedJavaTypeDescriptor();
|
||||
public JavaType<?> getRelationalJavaType() {
|
||||
return resolvedBasicType.getMappedJavaType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JdbcType getJdbcTypeDescriptor() {
|
||||
return resolvedBasicType.getJdbcTypeDescriptor();
|
||||
public JdbcType getJdbcType() {
|
||||
return resolvedBasicType.getJdbcType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -225,7 +225,7 @@ public class TypeDefinition implements Serializable {
|
|||
public MutabilityPlan<Object> getMutabilityPlan() {
|
||||
// a TypeDefinition does not explicitly provide a MutabilityPlan (yet?)
|
||||
return resolvedBasicType.isMutable()
|
||||
? getDomainJavaDescriptor().getMutabilityPlan()
|
||||
? getDomainJavaType().getMutabilityPlan()
|
||||
: ImmutableMutabilityPlan.instance();
|
||||
}
|
||||
};
|
||||
|
@ -236,9 +236,9 @@ public class TypeDefinition implements Serializable {
|
|||
|
||||
if ( Serializable.class.isAssignableFrom( typeImplementorClass ) ) {
|
||||
final JavaType<Serializable> jtd = typeConfiguration
|
||||
.getJavaTypeDescriptorRegistry()
|
||||
.getJavaTypeRegistry()
|
||||
.resolveDescriptor( typeImplementorClass );
|
||||
final JdbcType jdbcType = typeConfiguration.getJdbcTypeDescriptorRegistry().getDescriptor( Types.VARBINARY );
|
||||
final JdbcType jdbcType = typeConfiguration.getJdbcTypeRegistry().getDescriptor( Types.VARBINARY );
|
||||
final BasicType<Serializable> resolved = typeConfiguration.getBasicTypeRegistry().resolve( jtd, jdbcType );
|
||||
final SerializableType legacyType = new SerializableType( typeImplementorClass );
|
||||
|
||||
|
@ -254,18 +254,18 @@ public class TypeDefinition implements Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public JavaType<Object> getDomainJavaDescriptor() {
|
||||
return (JavaType) resolved.getMappedJavaTypeDescriptor();
|
||||
public JavaType<Object> getDomainJavaType() {
|
||||
return (JavaType) resolved.getMappedJavaType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaType<?> getRelationalJavaDescriptor() {
|
||||
return resolved.getMappedJavaTypeDescriptor();
|
||||
public JavaType<?> getRelationalJavaType() {
|
||||
return resolved.getMappedJavaType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JdbcType getJdbcTypeDescriptor() {
|
||||
return resolved.getJdbcTypeDescriptor();
|
||||
public JdbcType getJdbcType() {
|
||||
return resolved.getJdbcType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -277,7 +277,7 @@ public class TypeDefinition implements Serializable {
|
|||
public MutabilityPlan<Object> getMutabilityPlan() {
|
||||
// a TypeDefinition does not explicitly provide a MutabilityPlan (yet?)
|
||||
return resolved.isMutable()
|
||||
? getDomainJavaDescriptor().getMutabilityPlan()
|
||||
? getDomainJavaType().getMutabilityPlan()
|
||||
: ImmutableMutabilityPlan.instance();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -105,7 +105,7 @@ public abstract class AbstractConverterDescriptor implements ConverterDescriptor
|
|||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public JpaAttributeConverter createJpaAttributeConverter(JpaAttributeConverterCreationContext context) {
|
||||
final JavaType<Object> converterJtd = context
|
||||
.getJavaTypeDescriptorRegistry()
|
||||
.getJavaTypeRegistry()
|
||||
.getDescriptor( getAttributeConverterClass() );
|
||||
|
||||
final Class<?> domainJavaType = getDomainValueResolvedType().getErasedType();
|
||||
|
|
|
@ -21,7 +21,7 @@ public interface JpaAttributeConverterCreationContext {
|
|||
ManagedBeanRegistry getManagedBeanRegistry();
|
||||
TypeConfiguration getTypeConfiguration();
|
||||
|
||||
default JavaTypeRegistry getJavaTypeDescriptorRegistry() {
|
||||
return getTypeConfiguration().getJavaTypeDescriptorRegistry();
|
||||
default JavaTypeRegistry getJavaTypeRegistry() {
|
||||
return getTypeConfiguration().getJavaTypeRegistry();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import org.hibernate.type.ConvertedBasicType;
|
|||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
|
@ -25,7 +25,7 @@ public class ConvertedBasicTypeResolution<J> implements BasicValue.Resolution<J>
|
|||
|
||||
public ConvertedBasicTypeResolution(
|
||||
ConvertedBasicType basicType,
|
||||
JdbcTypeDescriptorIndicators stdIndicators) {
|
||||
JdbcTypeIndicators stdIndicators) {
|
||||
this.basicType = basicType;
|
||||
|
||||
final BasicValueConverter valueConverter = basicType.getValueConverter();
|
||||
|
@ -48,18 +48,18 @@ public class ConvertedBasicTypeResolution<J> implements BasicValue.Resolution<J>
|
|||
}
|
||||
|
||||
@Override
|
||||
public JavaType<J> getDomainJavaDescriptor() {
|
||||
return basicType.getValueConverter().getDomainJavaDescriptor();
|
||||
public JavaType<J> getDomainJavaType() {
|
||||
return basicType.getValueConverter().getDomainJavaType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaType<?> getRelationalJavaDescriptor() {
|
||||
return basicType.getValueConverter().getRelationalJavaDescriptor();
|
||||
public JavaType<?> getRelationalJavaType() {
|
||||
return basicType.getValueConverter().getRelationalJavaType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JdbcType getJdbcTypeDescriptor() {
|
||||
return adapted.getJdbcTypeDescriptor();
|
||||
public JdbcType getJdbcType() {
|
||||
return adapted.getJdbcType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -69,6 +69,6 @@ public class ConvertedBasicTypeResolution<J> implements BasicValue.Resolution<J>
|
|||
|
||||
@Override
|
||||
public MutabilityPlan<J> getMutabilityPlan() {
|
||||
return getDomainJavaDescriptor().getMutabilityPlan();
|
||||
return getDomainJavaType().getMutabilityPlan();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,17 +50,17 @@ public class EnumeratedValueResolution<E extends Enum<E>> implements BasicValue.
|
|||
}
|
||||
|
||||
@Override
|
||||
public JavaType<E> getDomainJavaDescriptor() {
|
||||
public JavaType<E> getDomainJavaType() {
|
||||
return domainJtd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaType<?> getRelationalJavaDescriptor() {
|
||||
public JavaType<?> getRelationalJavaType() {
|
||||
return jdbcJtd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JdbcType getJdbcTypeDescriptor() {
|
||||
public JdbcType getJdbcType() {
|
||||
return jdbcType;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,17 +57,17 @@ public class InferredBasicValueResolution<J> implements BasicValue.Resolution<J>
|
|||
}
|
||||
|
||||
@Override
|
||||
public JavaType<J> getDomainJavaDescriptor() {
|
||||
public JavaType<J> getDomainJavaType() {
|
||||
return domainJtd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaType<?> getRelationalJavaDescriptor() {
|
||||
public JavaType<?> getRelationalJavaType() {
|
||||
return relationalJtd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JdbcType getJdbcTypeDescriptor() {
|
||||
public JdbcType getJdbcType() {
|
||||
return jdbcType;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,13 +27,13 @@ import org.hibernate.type.CustomType;
|
|||
import org.hibernate.type.SerializableType;
|
||||
import org.hibernate.type.SqlTypes;
|
||||
import org.hibernate.type.descriptor.java.BasicJavaType;
|
||||
import org.hibernate.type.descriptor.java.EnumJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.EnumJavaType;
|
||||
import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
|
||||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
import org.hibernate.type.descriptor.java.SerializableJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.TemporalJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.SerializableJavaType;
|
||||
import org.hibernate.type.descriptor.java.TemporalJavaType;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||
import org.hibernate.type.descriptor.jdbc.ObjectJdbcType;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class InferredBasicValueResolver {
|
|||
Function<TypeConfiguration, JdbcType> explicitSqlTypeAccess,
|
||||
Type resolvedJavaType,
|
||||
Supplier<JavaType> reflectedJtdResolver,
|
||||
JdbcTypeDescriptorIndicators stdIndicators,
|
||||
JdbcTypeIndicators stdIndicators,
|
||||
Table table,
|
||||
Selectable selectable,
|
||||
String ownerName,
|
||||
|
@ -71,7 +71,7 @@ public class InferredBasicValueResolver {
|
|||
final BasicType<?> legacyType;
|
||||
|
||||
if ( explicitJavaType != null ) {
|
||||
// we have an explicit JavaTypeDescriptor
|
||||
// we have an explicit JavaType
|
||||
|
||||
if ( explicitJdbcType != null ) {
|
||||
// we also have an explicit JdbcType
|
||||
|
@ -88,18 +88,18 @@ public class InferredBasicValueResolver {
|
|||
if ( inferredJdbcType instanceof ObjectJdbcType ) {
|
||||
// have a "fallback" JDBC type... see if we can decide a better choice
|
||||
|
||||
if ( explicitJavaType instanceof EnumJavaTypeDescriptor ) {
|
||||
if ( explicitJavaType instanceof EnumJavaType ) {
|
||||
return fromEnum(
|
||||
(EnumJavaTypeDescriptor) reflectedJtd,
|
||||
(EnumJavaType) reflectedJtd,
|
||||
explicitJavaType,
|
||||
null,
|
||||
stdIndicators,
|
||||
typeConfiguration
|
||||
);
|
||||
}
|
||||
else if ( explicitJavaType instanceof TemporalJavaTypeDescriptor ) {
|
||||
else if ( explicitJavaType instanceof TemporalJavaType ) {
|
||||
return fromTemporal(
|
||||
(TemporalJavaTypeDescriptor) reflectedJtd,
|
||||
(TemporalJavaType) reflectedJtd,
|
||||
explicitJavaType,
|
||||
null,
|
||||
resolvedJavaType,
|
||||
|
@ -107,7 +107,7 @@ public class InferredBasicValueResolver {
|
|||
typeConfiguration
|
||||
);
|
||||
}
|
||||
else if ( explicitJavaType instanceof SerializableJavaTypeDescriptor || explicitJavaType.getJavaType() instanceof Serializable ) {
|
||||
else if ( explicitJavaType instanceof SerializableJavaType || explicitJavaType.getJavaType() instanceof Serializable ) {
|
||||
legacyType = new SerializableType<>( explicitJavaType );
|
||||
jdbcMapping = legacyType;
|
||||
}
|
||||
|
@ -143,18 +143,18 @@ public class InferredBasicValueResolver {
|
|||
else {
|
||||
// Use JTD if we know it to apply any specialized resolutions
|
||||
|
||||
if ( reflectedJtd instanceof EnumJavaTypeDescriptor ) {
|
||||
if ( reflectedJtd instanceof EnumJavaType ) {
|
||||
return fromEnum(
|
||||
(EnumJavaTypeDescriptor) reflectedJtd,
|
||||
(EnumJavaType) reflectedJtd,
|
||||
null,
|
||||
null,
|
||||
stdIndicators,
|
||||
typeConfiguration
|
||||
);
|
||||
}
|
||||
else if ( reflectedJtd instanceof TemporalJavaTypeDescriptor ) {
|
||||
else if ( reflectedJtd instanceof TemporalJavaType ) {
|
||||
return fromTemporal(
|
||||
(TemporalJavaTypeDescriptor) reflectedJtd,
|
||||
(TemporalJavaType) reflectedJtd,
|
||||
null,
|
||||
null,
|
||||
resolvedJavaType,
|
||||
|
@ -183,7 +183,7 @@ public class InferredBasicValueResolver {
|
|||
);
|
||||
legacyType = jdbcMapping;
|
||||
}
|
||||
else if ( reflectedJtd instanceof SerializableJavaTypeDescriptor || Serializable.class.isAssignableFrom( reflectedJtd.getJavaTypeClass() ) ) {
|
||||
else if ( reflectedJtd instanceof SerializableJavaType || Serializable.class.isAssignableFrom( reflectedJtd.getJavaTypeClass() ) ) {
|
||||
legacyType = new SerializableType<>( reflectedJtd );
|
||||
jdbcMapping = legacyType;
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ public class InferredBasicValueResolver {
|
|||
// we have neither a JTD nor STD
|
||||
|
||||
throw new MappingException(
|
||||
"Could not determine JavaTypeDescriptor nor SqlTypeDescriptor to use" +
|
||||
"Could not determine JavaType nor JdbcType to use" +
|
||||
" for BasicValue: owner = " + ownerName +
|
||||
"; property = " + propertyName +
|
||||
"; table = " + table.getName() +
|
||||
|
@ -245,7 +245,7 @@ public class InferredBasicValueResolver {
|
|||
|
||||
if ( jdbcMapping == null ) {
|
||||
throw new MappingException(
|
||||
"Could not determine JavaTypeDescriptor nor SqlTypeDescriptor to use" + "" +
|
||||
"Could not determine JavaType nor JdbcType to use" + "" +
|
||||
" for " + ( (BasicValue) stdIndicators ).getResolvedJavaType() +
|
||||
"; table = " + table.getName() +
|
||||
"; column = " + selectable.getText()
|
||||
|
@ -256,7 +256,7 @@ public class InferredBasicValueResolver {
|
|||
jdbcMapping,
|
||||
jdbcMapping.getJavaTypeDescriptor(),
|
||||
jdbcMapping.getJavaTypeDescriptor(),
|
||||
jdbcMapping.getJdbcTypeDescriptor(),
|
||||
jdbcMapping.getJdbcType(),
|
||||
null,
|
||||
legacyType,
|
||||
null
|
||||
|
@ -265,7 +265,7 @@ public class InferredBasicValueResolver {
|
|||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static BasicType<?> resolveSqlTypeIndicators(
|
||||
JdbcTypeDescriptorIndicators stdIndicators,
|
||||
JdbcTypeIndicators stdIndicators,
|
||||
BasicType<?> resolved,
|
||||
JavaType<?> domainJtd) {
|
||||
if ( resolved instanceof AdjustableBasicType ) {
|
||||
|
@ -280,10 +280,10 @@ public class InferredBasicValueResolver {
|
|||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static <E extends Enum<E>> InferredBasicValueResolution fromEnum(
|
||||
EnumJavaTypeDescriptor<E> enumJavaDescriptor,
|
||||
EnumJavaType<E> enumJavaType,
|
||||
BasicJavaType explicitJavaType,
|
||||
JdbcType explicitJdbcType,
|
||||
JdbcTypeDescriptorIndicators stdIndicators,
|
||||
JdbcTypeIndicators stdIndicators,
|
||||
TypeConfiguration typeConfiguration) {
|
||||
final EnumType enumStyle = stdIndicators.getEnumeratedType() != null
|
||||
? stdIndicators.getEnumeratedType()
|
||||
|
@ -295,7 +295,7 @@ public class InferredBasicValueResolver {
|
|||
if ( explicitJavaType != null ) {
|
||||
if ( ! String.class.isAssignableFrom( explicitJavaType.getJavaTypeClass() ) ) {
|
||||
throw new MappingException(
|
||||
"Explicit JavaTypeDescriptor [" + explicitJavaType +
|
||||
"Explicit JavaType [" + explicitJavaType +
|
||||
"] applied to enumerated value with EnumType#STRING" +
|
||||
" should handle `java.lang.String` as its relational type descriptor"
|
||||
);
|
||||
|
@ -305,20 +305,20 @@ public class InferredBasicValueResolver {
|
|||
else {
|
||||
final boolean useCharacter = stdIndicators.getColumnLength() == 1;
|
||||
final Class<?> relationalJavaType = useCharacter ? Character.class : String.class;
|
||||
relationalJtd = typeConfiguration.getJavaTypeDescriptorRegistry().getDescriptor( relationalJavaType );
|
||||
relationalJtd = typeConfiguration.getJavaTypeRegistry().getDescriptor( relationalJavaType );
|
||||
}
|
||||
|
||||
final JdbcType jdbcType = explicitJdbcType != null ? explicitJdbcType : relationalJtd.getRecommendedJdbcType( stdIndicators );
|
||||
|
||||
//noinspection unchecked
|
||||
final NamedEnumValueConverter valueConverter = new NamedEnumValueConverter(
|
||||
enumJavaDescriptor,
|
||||
enumJavaType,
|
||||
jdbcType,
|
||||
relationalJtd
|
||||
);
|
||||
|
||||
final org.hibernate.type.EnumType<E> legacyEnumType = new org.hibernate.type.EnumType<>(
|
||||
enumJavaDescriptor.getJavaTypeClass(),
|
||||
enumJavaType.getJavaTypeClass(),
|
||||
valueConverter,
|
||||
typeConfiguration
|
||||
);
|
||||
|
@ -330,7 +330,7 @@ public class InferredBasicValueResolver {
|
|||
//noinspection unchecked
|
||||
return new InferredBasicValueResolution(
|
||||
jdbcMapping,
|
||||
enumJavaDescriptor,
|
||||
enumJavaType,
|
||||
relationalJtd,
|
||||
jdbcType,
|
||||
valueConverter,
|
||||
|
@ -343,7 +343,7 @@ public class InferredBasicValueResolver {
|
|||
if ( explicitJavaType != null ) {
|
||||
if ( ! Integer.class.isAssignableFrom( explicitJavaType.getJavaTypeClass() ) ) {
|
||||
throw new MappingException(
|
||||
"Explicit JavaTypeDescriptor [" + explicitJavaType +
|
||||
"Explicit JavaType [" + explicitJavaType +
|
||||
"] applied to enumerated value with EnumType#ORDINAL" +
|
||||
" should handle `java.lang.Integer` as its relational type descriptor"
|
||||
);
|
||||
|
@ -352,22 +352,22 @@ public class InferredBasicValueResolver {
|
|||
relationalJtd = explicitJavaType;
|
||||
}
|
||||
else {
|
||||
relationalJtd = typeConfiguration.getJavaTypeDescriptorRegistry().getDescriptor( Integer.class );
|
||||
relationalJtd = typeConfiguration.getJavaTypeRegistry().getDescriptor( Integer.class );
|
||||
}
|
||||
|
||||
final JdbcType jdbcType = explicitJdbcType != null
|
||||
? explicitJdbcType
|
||||
: typeConfiguration.getJdbcTypeDescriptorRegistry().getDescriptor( SqlTypes.TINYINT );
|
||||
: typeConfiguration.getJdbcTypeRegistry().getDescriptor( SqlTypes.TINYINT );
|
||||
|
||||
//noinspection unchecked
|
||||
final OrdinalEnumValueConverter valueConverter = new OrdinalEnumValueConverter(
|
||||
enumJavaDescriptor,
|
||||
enumJavaType,
|
||||
jdbcType,
|
||||
relationalJtd
|
||||
);
|
||||
|
||||
final org.hibernate.type.EnumType<E> legacyEnumType = new org.hibernate.type.EnumType<>(
|
||||
enumJavaDescriptor.getJavaTypeClass(),
|
||||
enumJavaType.getJavaTypeClass(),
|
||||
valueConverter,
|
||||
typeConfiguration
|
||||
);
|
||||
|
@ -379,7 +379,7 @@ public class InferredBasicValueResolver {
|
|||
//noinspection unchecked
|
||||
return new InferredBasicValueResolution(
|
||||
jdbcMapping,
|
||||
enumJavaDescriptor,
|
||||
enumJavaType,
|
||||
relationalJtd,
|
||||
jdbcType,
|
||||
valueConverter,
|
||||
|
@ -395,11 +395,11 @@ public class InferredBasicValueResolver {
|
|||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public static InferredBasicValueResolution fromTemporal(
|
||||
TemporalJavaTypeDescriptor reflectedJtd,
|
||||
TemporalJavaType reflectedJtd,
|
||||
BasicJavaType explicitJavaType,
|
||||
JdbcType explicitJdbcType,
|
||||
Type resolvedJavaType,
|
||||
JdbcTypeDescriptorIndicators stdIndicators,
|
||||
JdbcTypeIndicators stdIndicators,
|
||||
TypeConfiguration typeConfiguration) {
|
||||
final TemporalType requestedTemporalPrecision = stdIndicators.getTemporalPrecision();
|
||||
|
||||
|
@ -407,19 +407,19 @@ public class InferredBasicValueResolver {
|
|||
// Case #1 - explicit JavaType
|
||||
|
||||
if ( explicitJavaType != null ) {
|
||||
if ( !TemporalJavaTypeDescriptor.class.isInstance( explicitJavaType ) ) {
|
||||
if ( !TemporalJavaType.class.isInstance( explicitJavaType ) ) {
|
||||
throw new MappingException(
|
||||
"Explicit JavaTypeDescriptor [" + explicitJavaType +
|
||||
"] defined for temporal value must implement TemporalJavaTypeDescriptor"
|
||||
"Explicit JavaType [" + explicitJavaType +
|
||||
"] defined for temporal value must implement TemporalJavaType"
|
||||
);
|
||||
}
|
||||
|
||||
final TemporalJavaTypeDescriptor explicitTemporalJtd = (TemporalJavaTypeDescriptor) explicitJavaType;
|
||||
final TemporalJavaType explicitTemporalJtd = (TemporalJavaType) explicitJavaType;
|
||||
|
||||
if ( requestedTemporalPrecision != null && explicitTemporalJtd.getPrecision() != requestedTemporalPrecision ) {
|
||||
throw new MappingException(
|
||||
"Temporal precision (`jakarta.persistence.TemporalType`) mismatch... requested precision = " + requestedTemporalPrecision +
|
||||
"; explicit JavaTypeDescriptor (`" + explicitTemporalJtd + "`) precision = " + explicitTemporalJtd.getPrecision()
|
||||
"; explicit JavaType (`" + explicitTemporalJtd + "`) precision = " + explicitTemporalJtd.getPrecision()
|
||||
|
||||
);
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ public class InferredBasicValueResolver {
|
|||
// due to the new annotations being used
|
||||
|
||||
if ( explicitJdbcType != null ) {
|
||||
final TemporalJavaTypeDescriptor jtd;
|
||||
final TemporalJavaType jtd;
|
||||
|
||||
if ( requestedTemporalPrecision != null ) {
|
||||
jtd = reflectedJtd.resolveTypeForPrecision(
|
||||
|
@ -472,7 +472,7 @@ public class InferredBasicValueResolver {
|
|||
}
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Case #3 - no explicit JavaTypeDescriptor or JdbcType
|
||||
// Case #3 - no explicit JavaType or JdbcType
|
||||
//
|
||||
// - for the moment continue to use the legacy resolution to registered
|
||||
// BasicType
|
||||
|
@ -480,7 +480,7 @@ public class InferredBasicValueResolver {
|
|||
if ( requestedTemporalPrecision != null && requestedTemporalPrecision != reflectedJtd.getPrecision() ) {
|
||||
basicType = typeConfiguration.getBasicTypeRegistry().resolve(
|
||||
reflectedJtd.resolveTypeForPrecision( requestedTemporalPrecision, typeConfiguration ),
|
||||
TemporalJavaTypeDescriptor.resolveJdbcTypeCode( requestedTemporalPrecision )
|
||||
TemporalJavaType.resolveJdbcTypeCode( requestedTemporalPrecision )
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
@ -494,7 +494,7 @@ public class InferredBasicValueResolver {
|
|||
basicType,
|
||||
basicType.getJavaTypeDescriptor(),
|
||||
basicType.getJavaTypeDescriptor(),
|
||||
basicType.getJdbcTypeDescriptor(),
|
||||
basicType.getJdbcType(),
|
||||
null,
|
||||
basicType,
|
||||
reflectedJtd.getMutabilityPlan()
|
||||
|
|
|
@ -63,20 +63,20 @@ public class NamedBasicTypeResolution<J> implements BasicValue.Resolution<J> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public JavaType<J> getDomainJavaDescriptor() {
|
||||
public JavaType<J> getDomainJavaType() {
|
||||
return domainJtd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaType<?> getRelationalJavaDescriptor() {
|
||||
public JavaType<?> getRelationalJavaType() {
|
||||
return valueConverter == null
|
||||
? basicType.getJavaTypeDescriptor()
|
||||
: valueConverter.getRelationalJavaDescriptor();
|
||||
: valueConverter.getRelationalJavaType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JdbcType getJdbcTypeDescriptor() {
|
||||
return basicType.getJdbcTypeDescriptor();
|
||||
public JdbcType getJdbcType() {
|
||||
return basicType.getJdbcType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
|
|||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
/**
|
||||
|
@ -40,7 +40,7 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
|
|||
Function<TypeConfiguration, BasicJavaType> explicitJtdAccess,
|
||||
Function<TypeConfiguration, JdbcType> explicitStdAccess,
|
||||
Function<TypeConfiguration, MutabilityPlan> explicitMutabilityPlanAccess,
|
||||
JdbcTypeDescriptorIndicators sqlTypeIndicators,
|
||||
JdbcTypeIndicators sqlTypeIndicators,
|
||||
JpaAttributeConverterCreationContext converterCreationContext,
|
||||
MetadataBuildingContext context) {
|
||||
return fromInternal(
|
||||
|
@ -58,7 +58,7 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
|
|||
Function<TypeConfiguration, BasicJavaType> explicitJtdAccess,
|
||||
Function<TypeConfiguration, JdbcType> explicitStdAccess,
|
||||
Function<TypeConfiguration, MutabilityPlan> explicitMutabilityPlanAccess,
|
||||
JdbcTypeDescriptorIndicators sqlTypeIndicators,
|
||||
JdbcTypeIndicators sqlTypeIndicators,
|
||||
JpaAttributeConverterCreationContext converterCreationContext,
|
||||
MetadataBuildingContext context) {
|
||||
assert name.startsWith( ConverterDescriptor.TYPE_NAME_PREFIX );
|
||||
|
@ -87,7 +87,7 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
|
|||
Function<TypeConfiguration, BasicJavaType> explicitJtdAccess,
|
||||
Function<TypeConfiguration, JdbcType> explicitStdAccess,
|
||||
Function<TypeConfiguration, MutabilityPlan> explicitMutabilityPlanAccess,
|
||||
JpaAttributeConverter converter, JdbcTypeDescriptorIndicators sqlTypeIndicators,
|
||||
JpaAttributeConverter converter, JdbcTypeIndicators sqlTypeIndicators,
|
||||
MetadataBuildingContext context) {
|
||||
final TypeConfiguration typeConfiguration = context.getBootstrapContext().getTypeConfiguration();
|
||||
|
||||
|
@ -97,13 +97,13 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
|
|||
|
||||
final JavaType domainJtd = explicitJtd != null
|
||||
? explicitJtd
|
||||
: converter.getDomainJavaDescriptor();
|
||||
: converter.getDomainJavaType();
|
||||
|
||||
final JdbcType explicitJdbcType = explicitStdAccess != null
|
||||
? explicitStdAccess.apply( typeConfiguration )
|
||||
: null;
|
||||
|
||||
final JavaType relationalJtd = converter.getRelationalJavaDescriptor();
|
||||
final JavaType relationalJtd = converter.getRelationalJavaType();
|
||||
|
||||
final JdbcType jdbcType = explicitJdbcType != null
|
||||
? explicitJdbcType
|
||||
|
@ -179,12 +179,12 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
|
|||
// private final ValueBinder binder = relationalStd.getBinder( relationalJtd );
|
||||
//
|
||||
// @Override
|
||||
// public JavaTypeDescriptor getJavaTypeDescriptor() {
|
||||
// public JavaType getJavaType() {
|
||||
// return relationalJtd;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public SqlTypeDescriptor getSqlTypeDescriptor() {
|
||||
// public JdbcType getJdbcType() {
|
||||
// return relationalStd;
|
||||
// }
|
||||
//
|
||||
|
@ -209,7 +209,7 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
|
|||
// );
|
||||
|
||||
this.legacyResolvedType = new AttributeConverterTypeAdapter(
|
||||
ConverterDescriptor.TYPE_NAME_PREFIX + valueConverter.getConverterJavaTypeDescriptor().getJavaType().getTypeName(),
|
||||
ConverterDescriptor.TYPE_NAME_PREFIX + valueConverter.getConverterJavaType().getJavaType().getTypeName(),
|
||||
String.format(
|
||||
"BasicType adapter for AttributeConverter<%s,%s>",
|
||||
domainJtd.getJavaType().getTypeName(),
|
||||
|
@ -230,18 +230,18 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public JavaType<J> getDomainJavaDescriptor() {
|
||||
public JavaType<J> getDomainJavaType() {
|
||||
//noinspection unchecked
|
||||
return domainJtd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaType<?> getRelationalJavaDescriptor() {
|
||||
public JavaType<?> getRelationalJavaType() {
|
||||
return relationalJtd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JdbcType getJdbcTypeDescriptor() {
|
||||
public JdbcType getJdbcType() {
|
||||
return jdbcType;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,18 +42,18 @@ public class UserTypeResolution implements BasicValue.Resolution {
|
|||
}
|
||||
|
||||
@Override
|
||||
public JavaType<?> getDomainJavaDescriptor() {
|
||||
public JavaType<?> getDomainJavaType() {
|
||||
return userTypeAdapter.getJavaTypeDescriptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaType<?> getRelationalJavaDescriptor() {
|
||||
public JavaType<?> getRelationalJavaType() {
|
||||
return userTypeAdapter.getJavaTypeDescriptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JdbcType getJdbcTypeDescriptor() {
|
||||
return userTypeAdapter.getJdbcTypeDescriptor();
|
||||
public JdbcType getJdbcType() {
|
||||
return userTypeAdapter.getJdbcType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.hibernate.type.descriptor.ValueBinder;
|
|||
import org.hibernate.type.descriptor.WrapperOptions;
|
||||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
|
@ -32,15 +32,15 @@ public class ValueConverterTypeAdapter<J> extends AbstractSingleColumnStandardBa
|
|||
public ValueConverterTypeAdapter(
|
||||
String description,
|
||||
BasicValueConverter<J, ?> converter,
|
||||
JdbcTypeDescriptorIndicators indicators) {
|
||||
JdbcTypeIndicators indicators) {
|
||||
super(
|
||||
converter.getRelationalJavaDescriptor().getRecommendedJdbcType( indicators ),
|
||||
(JavaType<J>) converter.getRelationalJavaDescriptor()
|
||||
converter.getRelationalJavaType().getRecommendedJdbcType( indicators ),
|
||||
(JavaType<J>) converter.getRelationalJavaType()
|
||||
);
|
||||
|
||||
this.description = description;
|
||||
this.converter = (BasicValueConverter<J, Object>) converter;
|
||||
this.valueBinder = getJdbcTypeDescriptor().getBinder( this.converter.getRelationalJavaDescriptor() );
|
||||
this.valueBinder = getJdbcType().getBinder( this.converter.getRelationalJavaType() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -66,13 +66,13 @@ public class ValueConverterTypeAdapter<J> extends AbstractSingleColumnStandardBa
|
|||
|
||||
@Override
|
||||
protected MutabilityPlan<J> getMutabilityPlan() {
|
||||
return converter.getDomainJavaDescriptor().getMutabilityPlan();
|
||||
return converter.getDomainJavaType().getMutabilityPlan();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEqual(Object one, Object another) {
|
||||
//noinspection unchecked
|
||||
return ( (JavaType<Object>) converter.getDomainJavaDescriptor() ).areEqual( one, another );
|
||||
return ( (JavaType<Object>) converter.getDomainJavaType() ).areEqual( one, another );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
|
|||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
/**
|
||||
|
@ -45,11 +45,11 @@ public class VersionResolution<E> implements BasicValue.Resolution<E> {
|
|||
// todo (6.0) : add support for Dialect-specific interpretation?
|
||||
|
||||
final java.lang.reflect.Type implicitJavaType = implicitJavaTypeAccess.apply( typeConfiguration );
|
||||
final JavaType registered = typeConfiguration.getJavaTypeDescriptorRegistry().resolveDescriptor( implicitJavaType );
|
||||
final JavaType registered = typeConfiguration.getJavaTypeRegistry().resolveDescriptor( implicitJavaType );
|
||||
final BasicJavaType jtd = (BasicJavaType) registered;
|
||||
|
||||
final JdbcType recommendedJdbcType = jtd.getRecommendedJdbcType(
|
||||
new JdbcTypeDescriptorIndicators() {
|
||||
new JdbcTypeIndicators() {
|
||||
@Override
|
||||
public TypeConfiguration getTypeConfiguration() {
|
||||
return typeConfiguration;
|
||||
|
@ -81,23 +81,23 @@ public class VersionResolution<E> implements BasicValue.Resolution<E> {
|
|||
final BasicType<?> basicType = typeConfiguration.getBasicTypeRegistry().resolve( jtd, recommendedJdbcType );
|
||||
final BasicType legacyType = typeConfiguration.getBasicTypeRegistry().getRegisteredType( jtd.getJavaType() );
|
||||
|
||||
assert legacyType.getJdbcTypeDescriptor().equals( recommendedJdbcType );
|
||||
assert legacyType.getJdbcType().equals( recommendedJdbcType );
|
||||
|
||||
return new VersionResolution<>( jtd, recommendedJdbcType, basicType, legacyType );
|
||||
}
|
||||
|
||||
private final JavaType jtd;
|
||||
private final JavaType javaType;
|
||||
private final JdbcType jdbcType;
|
||||
|
||||
private final JdbcMapping jdbcMapping;
|
||||
private final BasicType legacyType;
|
||||
|
||||
public VersionResolution(
|
||||
JavaType javaTypeDescriptor,
|
||||
JavaType javaType,
|
||||
JdbcType jdbcType,
|
||||
JdbcMapping jdbcMapping,
|
||||
BasicType legacyType) {
|
||||
this.jtd = javaTypeDescriptor;
|
||||
this.javaType = javaType;
|
||||
this.jdbcType = jdbcType;
|
||||
this.jdbcMapping = jdbcMapping;
|
||||
this.legacyType = legacyType;
|
||||
|
@ -116,17 +116,17 @@ public class VersionResolution<E> implements BasicValue.Resolution<E> {
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public JavaType<E> getDomainJavaDescriptor() {
|
||||
return jtd;
|
||||
public JavaType<E> getDomainJavaType() {
|
||||
return javaType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaType<?> getRelationalJavaDescriptor() {
|
||||
return jtd;
|
||||
public JavaType<?> getRelationalJavaType() {
|
||||
return javaType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JdbcType getJdbcTypeDescriptor() {
|
||||
public JdbcType getJdbcType() {
|
||||
return jdbcType;
|
||||
}
|
||||
|
||||
|
|
|
@ -369,7 +369,7 @@ public class MetadataBuildingProcess {
|
|||
}
|
||||
|
||||
private void conditionallyRegisterJtd(JavaType jtd) {
|
||||
final JavaTypeRegistry jtdRegistry = getTypeConfiguration().getJavaTypeDescriptorRegistry();
|
||||
final JavaTypeRegistry jtdRegistry = getTypeConfiguration().getJavaTypeRegistry();
|
||||
jtdRegistry.resolveDescriptor( jtd.getJavaTypeClass(), () -> jtd );
|
||||
}
|
||||
|
||||
|
@ -385,13 +385,13 @@ public class MetadataBuildingProcess {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void contributeJavaTypeDescriptor(JavaType descriptor) {
|
||||
typeConfiguration.getJavaTypeDescriptorRegistry().addDescriptor( descriptor );
|
||||
public void contributeJavaType(JavaType<?> descriptor) {
|
||||
typeConfiguration.getJavaTypeRegistry().addDescriptor( descriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contributeJdbcTypeDescriptor(JdbcType descriptor) {
|
||||
typeConfiguration.getJdbcTypeDescriptorRegistry().addDescriptor( descriptor );
|
||||
public void contributeJdbcType(JdbcType descriptor) {
|
||||
typeConfiguration.getJdbcTypeRegistry().addDescriptor( descriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -424,7 +424,7 @@ public class MetadataBuildingProcess {
|
|||
|
||||
// add fallback type descriptors
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = typeConfiguration
|
||||
.getJdbcTypeDescriptorRegistry();
|
||||
.getJdbcTypeRegistry();
|
||||
addFallbackIfNecessary( jdbcTypeRegistry, SqlTypes.UUID, SqlTypes.BINARY );
|
||||
addFallbackIfNecessary( jdbcTypeRegistry, SqlTypes.JSON, SqlTypes.VARBINARY );
|
||||
addFallbackIfNecessary( jdbcTypeRegistry, SqlTypes.INET, SqlTypes.VARBINARY );
|
||||
|
@ -439,7 +439,7 @@ public class MetadataBuildingProcess {
|
|||
// For NORMALIZE, we replace the standard types that use TIMESTAMP_WITH_TIMEZONE to use TIMESTAMP
|
||||
if ( options.getDefaultTimeZoneStorage() == TimeZoneStorageStrategy.NORMALIZE ) {
|
||||
final JavaTypeRegistry javaTypeRegistry = typeConfiguration
|
||||
.getJavaTypeDescriptorRegistry();
|
||||
.getJavaTypeRegistry();
|
||||
final JdbcType timestampDescriptor = jdbcTypeRegistry.getDescriptor( Types.TIMESTAMP );
|
||||
final BasicTypeRegistry basicTypeRegistry = typeConfiguration.getBasicTypeRegistry();
|
||||
final BasicType<?> offsetDateTimeType = new NamedBasicTypeImpl<>(
|
||||
|
|
|
@ -74,7 +74,7 @@ public class HibernateTypeSourceImpl implements HibernateTypeSource, JavaTypeDes
|
|||
public void resolveJavaTypeDescriptor(JavaTypeDescriptor descriptor) {
|
||||
if ( this.javaTypeDescriptor != null ) {
|
||||
if ( this.javaTypeDescriptor != descriptor ) {
|
||||
throw new IllegalStateException( "Attempt to resolve an already resolved JavaTypeDescriptor" );
|
||||
throw new IllegalStateException( "Attempt to resolve an already resolved JavaType" );
|
||||
}
|
||||
}
|
||||
this.javaTypeDescriptor = descriptor;
|
||||
|
|
|
@ -141,7 +141,6 @@ import org.hibernate.mapping.Set;
|
|||
import org.hibernate.mapping.SimpleValue;
|
||||
import org.hibernate.mapping.SingleTableSubclass;
|
||||
import org.hibernate.mapping.SortableValue;
|
||||
import org.hibernate.mapping.SyntheticProperty;
|
||||
import org.hibernate.mapping.Table;
|
||||
import org.hibernate.mapping.UnionSubclass;
|
||||
import org.hibernate.mapping.UniqueKey;
|
||||
|
@ -1964,7 +1963,7 @@ public class ModelBinder {
|
|||
.getBasicTypeRegistry()
|
||||
.getRegisteredType( value.getTypeName() );
|
||||
if ( basicType instanceof AbstractSingleColumnStandardBasicType ) {
|
||||
if ( isLob( basicType.getJdbcTypeDescriptor().getJdbcTypeCode(), null ) ) {
|
||||
if ( isLob( basicType.getJdbcType().getJdbcTypeCode(), null ) ) {
|
||||
value.makeLob();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ public class SqlResultSetMappingDescriptor implements NamedResultSetMappingDescr
|
|||
|
||||
final SessionFactoryImplementor sessionFactory = resolutionContext.getSessionFactory();
|
||||
final JavaType<?> targetJtd = sessionFactory.getTypeConfiguration()
|
||||
.getJavaTypeDescriptorRegistry()
|
||||
.getJavaTypeRegistry()
|
||||
.getDescriptor( targetJavaType );
|
||||
|
||||
return new ResultMementoInstantiationStandard( targetJtd, argumentResultMementos );
|
||||
|
|
|
@ -233,7 +233,7 @@ public class EnabledCaching implements CacheImplementor, DomainDataRegionBuildin
|
|||
return false;
|
||||
}
|
||||
|
||||
final Object idValue = entityDescriptor.getIdentifierMapping().getJavaTypeDescriptor().coerce(
|
||||
final Object idValue = entityDescriptor.getIdentifierMapping().getJavaType().coerce(
|
||||
identifier,
|
||||
sessionFactory::getTypeConfiguration
|
||||
);
|
||||
|
|
|
@ -906,28 +906,28 @@ public final class AnnotationBinder {
|
|||
|
||||
final JavaTypeRegistration javaTypeAnn = annotatedElement.getAnnotation( JavaTypeRegistration.class );
|
||||
if ( javaTypeAnn != null ) {
|
||||
handleJavaTypeDescriptorRegistration( context, managedBeanRegistry, javaTypeAnn );
|
||||
handleJavaTypeRegistration( context, managedBeanRegistry, javaTypeAnn );
|
||||
}
|
||||
else {
|
||||
final JavaTypeRegistrations annotation = annotatedElement.getAnnotation( JavaTypeRegistrations.class );
|
||||
if ( annotation != null ) {
|
||||
final JavaTypeRegistration[] registrations = annotation.value();
|
||||
for ( int i = 0; i < registrations.length; i++ ) {
|
||||
handleJavaTypeDescriptorRegistration( context, managedBeanRegistry, registrations[i] );
|
||||
handleJavaTypeRegistration( context, managedBeanRegistry, registrations[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final JdbcTypeRegistration jdbcTypeAnn = annotatedElement.getAnnotation( JdbcTypeRegistration.class );
|
||||
if ( jdbcTypeAnn != null ) {
|
||||
handleSqlTypeDescriptorRegistration( context, managedBeanRegistry, jdbcTypeAnn );
|
||||
handleJdbcTypeRegistration( context, managedBeanRegistry, jdbcTypeAnn );
|
||||
}
|
||||
else {
|
||||
final JdbcTypeRegistrations jdbcTypesAnn = annotatedElement.getAnnotation( JdbcTypeRegistrations.class );
|
||||
if ( jdbcTypesAnn != null ) {
|
||||
final JdbcTypeRegistration[] registrations = jdbcTypesAnn.value();
|
||||
for ( int i = 0; i < registrations.length; i++ ) {
|
||||
handleSqlTypeDescriptorRegistration( context, managedBeanRegistry, registrations[ i ] );
|
||||
handleJdbcTypeRegistration( context, managedBeanRegistry, registrations[ i ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -945,7 +945,7 @@ public final class AnnotationBinder {
|
|||
}
|
||||
}
|
||||
|
||||
private static void handleSqlTypeDescriptorRegistration(
|
||||
private static void handleJdbcTypeRegistration(
|
||||
MetadataBuildingContext context,
|
||||
ManagedBeanRegistry managedBeanRegistry,
|
||||
JdbcTypeRegistration annotation) {
|
||||
|
@ -958,7 +958,7 @@ public final class AnnotationBinder {
|
|||
context.getMetadataCollector().addJdbcTypeRegistration( typeCode, jdbcType );
|
||||
}
|
||||
|
||||
private static void handleJavaTypeDescriptorRegistration(
|
||||
private static void handleJavaTypeRegistration(
|
||||
MetadataBuildingContext context,
|
||||
ManagedBeanRegistry managedBeanRegistry,
|
||||
JavaTypeRegistration annotation) {
|
||||
|
|
|
@ -842,7 +842,7 @@ public class BinderHelper {
|
|||
|
||||
final JavaType<?> discriminatorJavaType = discriminatorDescriptor
|
||||
.resolve()
|
||||
.getRelationalJavaDescriptor();
|
||||
.getRelationalJavaType();
|
||||
|
||||
final Map<Object,Class<?>> discriminatorValueMappings = new HashMap<>();
|
||||
processAnyDiscriminatorValues(
|
||||
|
|
|
@ -79,7 +79,7 @@ import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
|
|||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
import org.hibernate.usertype.DynamicParameterizedType;
|
||||
import org.hibernate.usertype.UserType;
|
||||
|
@ -105,7 +105,7 @@ import static org.hibernate.cfg.annotations.HCANNHelper.findAnnotation;
|
|||
* @author Steve Ebersole
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class BasicValueBinder<T> implements JdbcTypeDescriptorIndicators {
|
||||
public class BasicValueBinder<T> implements JdbcTypeIndicators {
|
||||
|
||||
// todo (6.0) : In light of how we want to build Types (specifically BasicTypes) moving forward this class should undergo major changes
|
||||
// see the comments in #setType
|
||||
|
@ -437,7 +437,7 @@ public class BasicValueBinder<T> implements JdbcTypeDescriptorIndicators {
|
|||
final CollectionIdJdbcTypeCode jdbcTypeCodeAnn = findAnnotation( modelXProperty, CollectionIdJdbcTypeCode.class );
|
||||
if ( jdbcTypeCodeAnn != null ) {
|
||||
if ( jdbcTypeCodeAnn.value() != Integer.MIN_VALUE ) {
|
||||
return typeConfiguration.getJdbcTypeDescriptorRegistry().getDescriptor( jdbcTypeCodeAnn.value() );
|
||||
return typeConfiguration.getJdbcTypeRegistry().getDescriptor( jdbcTypeCodeAnn.value() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -482,7 +482,7 @@ public class BasicValueBinder<T> implements JdbcTypeDescriptorIndicators {
|
|||
return ImmutableMutabilityPlan.instance();
|
||||
}
|
||||
|
||||
// generally, this will trigger usage of the `JavaTypeDescriptor#getMutabilityPlan`
|
||||
// generally, this will trigger usage of the `JavaType#getMutabilityPlan`
|
||||
return null;
|
||||
};
|
||||
|
||||
|
@ -534,7 +534,7 @@ public class BasicValueBinder<T> implements JdbcTypeDescriptorIndicators {
|
|||
if ( jdbcTypeCodeAnn != null ) {
|
||||
final int jdbcTypeCode = jdbcTypeCodeAnn.value();
|
||||
if ( jdbcTypeCode != Integer.MIN_VALUE ) {
|
||||
return typeConfiguration.getJdbcTypeDescriptorRegistry().getDescriptor( jdbcTypeCode );
|
||||
return typeConfiguration.getJdbcTypeRegistry().getDescriptor( jdbcTypeCode );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -553,7 +553,7 @@ public class BasicValueBinder<T> implements JdbcTypeDescriptorIndicators {
|
|||
|
||||
final MapKeyClass mapKeyClassAnn = mapAttribute.getAnnotation( MapKeyClass.class );
|
||||
if ( mapKeyClassAnn != null ) {
|
||||
return (BasicJavaType) typeConfiguration.getJavaTypeDescriptorRegistry().getDescriptor( mapKeyClassAnn.value() );
|
||||
return (BasicJavaType) typeConfiguration.getJavaTypeRegistry().getDescriptor( mapKeyClassAnn.value() );
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -599,7 +599,7 @@ public class BasicValueBinder<T> implements JdbcTypeDescriptorIndicators {
|
|||
}
|
||||
}
|
||||
|
||||
// generally, this will trigger usage of the `JavaTypeDescriptor#getMutabilityPlan`
|
||||
// generally, this will trigger usage of the `JavaType#getMutabilityPlan`
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
@ -637,7 +637,7 @@ public class BasicValueBinder<T> implements JdbcTypeDescriptorIndicators {
|
|||
|
||||
final ListIndexJdbcTypeCode jdbcTypeCodeAnn = findAnnotation( listAttribute, ListIndexJdbcTypeCode.class );
|
||||
if ( jdbcTypeCodeAnn != null ) {
|
||||
return typeConfiguration.getJdbcTypeDescriptorRegistry().getDescriptor( jdbcTypeCodeAnn.value() );
|
||||
return typeConfiguration.getJdbcTypeRegistry().getDescriptor( jdbcTypeCodeAnn.value() );
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -811,7 +811,7 @@ public class BasicValueBinder<T> implements JdbcTypeDescriptorIndicators {
|
|||
}
|
||||
|
||||
return (BasicJavaType) typeConfiguration
|
||||
.getJavaTypeDescriptorRegistry()
|
||||
.getJavaTypeRegistry()
|
||||
.getDescriptor( elementCollectionAnn.targetClass() );
|
||||
};
|
||||
}
|
||||
|
@ -904,7 +904,7 @@ public class BasicValueBinder<T> implements JdbcTypeDescriptorIndicators {
|
|||
|
||||
final Class<?> hintedJavaType = (Class<?>) implicitJavaTypeAccess.apply( typeConfiguration );
|
||||
final JavaType<Object> hintedDescriptor = typeConfiguration
|
||||
.getJavaTypeDescriptorRegistry()
|
||||
.getJavaTypeRegistry()
|
||||
.getDescriptor( hintedJavaType );
|
||||
return hintedDescriptor.getRecommendedJdbcType( typeConfiguration.getCurrentBaseSqlTypeIndicators() );
|
||||
};
|
||||
|
@ -932,7 +932,7 @@ public class BasicValueBinder<T> implements JdbcTypeDescriptorIndicators {
|
|||
if ( javaClassAnn != null ) {
|
||||
//noinspection rawtypes
|
||||
return (BasicJavaType) typeConfiguration
|
||||
.getJavaTypeDescriptorRegistry()
|
||||
.getJavaTypeRegistry()
|
||||
.getDescriptor( javaClassAnn.value() );
|
||||
}
|
||||
|
||||
|
@ -952,7 +952,7 @@ public class BasicValueBinder<T> implements JdbcTypeDescriptorIndicators {
|
|||
final AnyKeyJdbcTypeCode jdbcTypeCodeAnn = findAnnotation( modelXProperty, AnyKeyJdbcTypeCode.class );
|
||||
if ( jdbcTypeCodeAnn != null ) {
|
||||
if ( jdbcTypeCodeAnn.value() != Integer.MIN_VALUE ) {
|
||||
return typeConfiguration.getJdbcTypeDescriptorRegistry().getDescriptor( jdbcTypeCodeAnn.value() );
|
||||
return typeConfiguration.getJdbcTypeRegistry().getDescriptor( jdbcTypeCodeAnn.value() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -981,7 +981,7 @@ public class BasicValueBinder<T> implements JdbcTypeDescriptorIndicators {
|
|||
if ( jdbcTypeCodeAnn != null ) {
|
||||
final int jdbcTypeCode = jdbcTypeCodeAnn.value();
|
||||
if ( jdbcTypeCode != Integer.MIN_VALUE ) {
|
||||
return typeConfiguration.getJdbcTypeDescriptorRegistry().getDescriptor( jdbcTypeCode );
|
||||
return typeConfiguration.getJdbcTypeRegistry().getDescriptor( jdbcTypeCode );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1041,7 +1041,7 @@ public class BasicValueBinder<T> implements JdbcTypeDescriptorIndicators {
|
|||
}
|
||||
}
|
||||
|
||||
// generally, this will trigger usage of the `JavaTypeDescriptor#getMutabilityPlan`
|
||||
// generally, this will trigger usage of the `JavaType#getMutabilityPlan`
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
@ -1067,7 +1067,7 @@ public class BasicValueBinder<T> implements JdbcTypeDescriptorIndicators {
|
|||
final Target targetAnn = findAnnotation( attributeXProperty, Target.class );
|
||||
if ( targetAnn != null ) {
|
||||
return (BasicJavaType) typeConfiguration
|
||||
.getJavaTypeDescriptorRegistry()
|
||||
.getJavaTypeRegistry()
|
||||
.getDescriptor( targetAnn.value() );
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public class StandardArraySemantics<E> implements CollectionSemantics<E[], E> {
|
|||
int anticipatedSize,
|
||||
CollectionPersister collectionDescriptor) {
|
||||
// return (Object[]) Array.newInstance(
|
||||
// collectionDescriptor.getJavaTypeDescriptor().getJavaType().getComponentType(),
|
||||
// collectionDescriptor.getJavaType().getJavaType().getComponentType(),
|
||||
// anticipatedSize
|
||||
// );
|
||||
throw new UnsupportedOperationException();
|
||||
|
|
|
@ -60,7 +60,7 @@ import org.hibernate.type.descriptor.ValueBinder;
|
|||
import org.hibernate.type.descriptor.ValueExtractor;
|
||||
import org.hibernate.type.descriptor.WrapperOptions;
|
||||
import org.hibernate.type.descriptor.java.DataHelper;
|
||||
import org.hibernate.type.descriptor.java.DoubleJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.DoubleJavaType;
|
||||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
import org.hibernate.type.descriptor.jdbc.*;
|
||||
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
|
||||
|
@ -891,7 +891,7 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
TREAT_DOUBLE_TYPED_FIELDS_AS_DECIMAL_DEFAULT_VALUE);
|
||||
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
|
||||
.getJdbcTypeDescriptorRegistry();
|
||||
.getJdbcTypeRegistry();
|
||||
if (treatDoubleTypedFieldsAsDecimal) {
|
||||
registerHibernateType( Types.FLOAT, StandardBasicTypes.BIG_DECIMAL.getName() );
|
||||
registerHibernateType( Types.REAL, StandardBasicTypes.BIG_DECIMAL.getName() );
|
||||
|
@ -899,7 +899,7 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
typeContributions.getTypeConfiguration().getBasicTypeRegistry()
|
||||
.register(
|
||||
new BasicTypeImpl<>(
|
||||
DoubleJavaTypeDescriptor.INSTANCE,
|
||||
DoubleJavaType.INSTANCE,
|
||||
NumericJdbcType.INSTANCE
|
||||
),
|
||||
Double.class.getName()
|
||||
|
@ -1332,12 +1332,12 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <X> ValueBinder<X> getBinder(JavaType<X> javaTypeDescriptor) {
|
||||
return new BasicBinder<>( javaTypeDescriptor, this ) {
|
||||
public <X> ValueBinder<X> getBinder(JavaType<X> javaType) {
|
||||
return new BasicBinder<>( javaType, this ) {
|
||||
|
||||
@Override
|
||||
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
|
||||
final BinaryStream binaryStream = javaTypeDescriptor.unwrap( value, BinaryStream.class, options );
|
||||
final BinaryStream binaryStream = javaType.unwrap( value, BinaryStream.class, options );
|
||||
if ( value instanceof BlobImplementer ) {
|
||||
try ( InputStream is = new CloseSuppressingInputStream( binaryStream.getInputStream() ) ) {
|
||||
st.setBinaryStream( index, is, binaryStream.getLength() );
|
||||
|
@ -1353,7 +1353,7 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
|
||||
@Override
|
||||
protected void doBind(CallableStatement st, X value, String name, WrapperOptions options) throws SQLException {
|
||||
final BinaryStream binaryStream = javaTypeDescriptor.unwrap( value, BinaryStream.class, options );
|
||||
final BinaryStream binaryStream = javaType.unwrap( value, BinaryStream.class, options );
|
||||
if ( value instanceof BlobImplementer ) {
|
||||
try ( InputStream is = new CloseSuppressingInputStream( binaryStream.getInputStream() ) ) {
|
||||
st.setBinaryStream( name, is, binaryStream.getLength() );
|
||||
|
@ -1370,27 +1370,27 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <X> ValueExtractor<X> getExtractor(JavaType<X> javaTypeDescriptor) {
|
||||
return new BasicExtractor<>( javaTypeDescriptor, this ) {
|
||||
public <X> ValueExtractor<X> getExtractor(JavaType<X> javaType) {
|
||||
return new BasicExtractor<>( javaType, this ) {
|
||||
|
||||
@Override
|
||||
protected X doExtract(ResultSet rs, int paramIndex, WrapperOptions options) throws SQLException {
|
||||
Blob rsBlob = rs.getBlob( paramIndex );
|
||||
if ( rsBlob == null || rsBlob.length() < HANAStreamBlobType.this.maxLobPrefetchSize ) {
|
||||
return javaTypeDescriptor.wrap( rsBlob, options );
|
||||
return javaType.wrap( rsBlob, options );
|
||||
}
|
||||
Blob blob = new MaterializedBlob( DataHelper.extractBytes( rsBlob.getBinaryStream() ) );
|
||||
return javaTypeDescriptor.wrap( blob, options );
|
||||
return javaType.wrap( blob, options );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected X doExtract(CallableStatement statement, int index, WrapperOptions options) throws SQLException {
|
||||
return javaTypeDescriptor.wrap( statement.getBlob( index ), options );
|
||||
return javaType.wrap( statement.getBlob( index ), options );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected X doExtract(CallableStatement statement, String name, WrapperOptions options) throws SQLException {
|
||||
return javaTypeDescriptor.wrap( statement.getBlob( name ), options );
|
||||
return javaType.wrap( statement.getBlob( name ), options );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -1423,12 +1423,12 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <X> BasicBinder<X> getClobBinder(final JavaType<X> javaTypeDescriptor) {
|
||||
return new BasicBinder<>( javaTypeDescriptor, this ) {
|
||||
public <X> BasicBinder<X> getClobBinder(final JavaType<X> javaType) {
|
||||
return new BasicBinder<>( javaType, this ) {
|
||||
|
||||
@Override
|
||||
protected void doBind(final PreparedStatement st, final X value, final int index, final WrapperOptions options) throws SQLException {
|
||||
final CharacterStream characterStream = javaTypeDescriptor.unwrap( value, CharacterStream.class, options );
|
||||
final CharacterStream characterStream = javaType.unwrap( value, CharacterStream.class, options );
|
||||
|
||||
if ( value instanceof ClobImplementer ) {
|
||||
try ( Reader r = new CloseSuppressingReader( characterStream.asReader() ) ) {
|
||||
|
@ -1446,7 +1446,7 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
|
||||
@Override
|
||||
protected void doBind(CallableStatement st, X value, String name, WrapperOptions options) throws SQLException {
|
||||
final CharacterStream characterStream = javaTypeDescriptor.unwrap( value, CharacterStream.class, options );
|
||||
final CharacterStream characterStream = javaType.unwrap( value, CharacterStream.class, options );
|
||||
|
||||
if ( value instanceof ClobImplementer ) {
|
||||
try ( Reader r = new CloseSuppressingReader( characterStream.asReader() ) ) {
|
||||
|
@ -1464,8 +1464,8 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <X> ValueExtractor<X> getExtractor(JavaType<X> javaTypeDescriptor) {
|
||||
return new BasicExtractor<>( javaTypeDescriptor, this ) {
|
||||
public <X> ValueExtractor<X> getExtractor(JavaType<X> javaType) {
|
||||
return new BasicExtractor<>( javaType, this ) {
|
||||
|
||||
@Override
|
||||
protected X doExtract(ResultSet rs, int paramIndex, WrapperOptions options) throws SQLException {
|
||||
|
@ -1478,20 +1478,20 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
}
|
||||
|
||||
if ( rsClob == null || rsClob.length() < HANAClobJdbcType.this.maxLobPrefetchSize ) {
|
||||
return javaTypeDescriptor.wrap( rsClob, options );
|
||||
return javaType.wrap( rsClob, options );
|
||||
}
|
||||
Clob clob = new MaterializedNClob( DataHelper.extractString( rsClob ) );
|
||||
return javaTypeDescriptor.wrap( clob, options );
|
||||
return javaType.wrap( clob, options );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected X doExtract(CallableStatement statement, int index, WrapperOptions options) throws SQLException {
|
||||
return javaTypeDescriptor.wrap( statement.getClob( index ), options );
|
||||
return javaType.wrap( statement.getClob( index ), options );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected X doExtract(CallableStatement statement, String name, WrapperOptions options) throws SQLException {
|
||||
return javaTypeDescriptor.wrap( statement.getClob( name ), options );
|
||||
return javaType.wrap( statement.getClob( name ), options );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -1522,12 +1522,12 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <X> BasicBinder<X> getNClobBinder(final JavaType<X> javaTypeDescriptor) {
|
||||
return new BasicBinder<>( javaTypeDescriptor, this ) {
|
||||
public <X> BasicBinder<X> getNClobBinder(final JavaType<X> javaType) {
|
||||
return new BasicBinder<>( javaType, this ) {
|
||||
|
||||
@Override
|
||||
protected void doBind(final PreparedStatement st, final X value, final int index, final WrapperOptions options) throws SQLException {
|
||||
final CharacterStream characterStream = javaTypeDescriptor.unwrap( value, CharacterStream.class, options );
|
||||
final CharacterStream characterStream = javaType.unwrap( value, CharacterStream.class, options );
|
||||
|
||||
if ( value instanceof NClobImplementer ) {
|
||||
try ( Reader r = new CloseSuppressingReader( characterStream.asReader() ) ) {
|
||||
|
@ -1545,7 +1545,7 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
|
||||
@Override
|
||||
protected void doBind(CallableStatement st, X value, String name, WrapperOptions options) throws SQLException {
|
||||
final CharacterStream characterStream = javaTypeDescriptor.unwrap( value, CharacterStream.class, options );
|
||||
final CharacterStream characterStream = javaType.unwrap( value, CharacterStream.class, options );
|
||||
|
||||
if ( value instanceof NClobImplementer ) {
|
||||
try ( Reader r = new CloseSuppressingReader( characterStream.asReader() ) ) {
|
||||
|
@ -1563,27 +1563,27 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <X> ValueExtractor<X> getExtractor(JavaType<X> javaTypeDescriptor) {
|
||||
return new BasicExtractor<>( javaTypeDescriptor, this ) {
|
||||
public <X> ValueExtractor<X> getExtractor(JavaType<X> javaType) {
|
||||
return new BasicExtractor<>( javaType, this ) {
|
||||
|
||||
@Override
|
||||
protected X doExtract(ResultSet rs, int paramIndex, WrapperOptions options) throws SQLException {
|
||||
NClob rsNClob = rs.getNClob( paramIndex );
|
||||
if ( rsNClob == null || rsNClob.length() < HANANClobJdbcType.this.maxLobPrefetchSize ) {
|
||||
return javaTypeDescriptor.wrap( rsNClob, options );
|
||||
return javaType.wrap( rsNClob, options );
|
||||
}
|
||||
NClob nClob = new MaterializedNClob( DataHelper.extractString( rsNClob ) );
|
||||
return javaTypeDescriptor.wrap( nClob, options );
|
||||
return javaType.wrap( nClob, options );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected X doExtract(CallableStatement statement, int index, WrapperOptions options) throws SQLException {
|
||||
return javaTypeDescriptor.wrap( statement.getNClob( index ), options );
|
||||
return javaType.wrap( statement.getNClob( index ), options );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected X doExtract(CallableStatement statement, String name, WrapperOptions options) throws SQLException {
|
||||
return javaTypeDescriptor.wrap( statement.getNClob( name ), options );
|
||||
return javaType.wrap( statement.getNClob( name ), options );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -1622,34 +1622,34 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <X> ValueExtractor<X> getExtractor(final JavaType<X> javaTypeDescriptor) {
|
||||
return new BasicExtractor<>( javaTypeDescriptor, this ) {
|
||||
public <X> ValueExtractor<X> getExtractor(final JavaType<X> javaType) {
|
||||
return new BasicExtractor<>( javaType, this ) {
|
||||
|
||||
@Override
|
||||
protected X doExtract(ResultSet rs, int paramIndex, WrapperOptions options) throws SQLException {
|
||||
Blob rsBlob = rs.getBlob( paramIndex );
|
||||
if ( rsBlob == null || rsBlob.length() < HANABlobType.this.maxLobPrefetchSize ) {
|
||||
return javaTypeDescriptor.wrap( rsBlob, options );
|
||||
return javaType.wrap( rsBlob, options );
|
||||
}
|
||||
Blob blob = new MaterializedBlob( DataHelper.extractBytes( rsBlob.getBinaryStream() ) );
|
||||
return javaTypeDescriptor.wrap( blob, options );
|
||||
return javaType.wrap( blob, options );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected X doExtract(CallableStatement statement, int index, WrapperOptions options) throws SQLException {
|
||||
return javaTypeDescriptor.wrap( statement.getBlob( index ), options );
|
||||
return javaType.wrap( statement.getBlob( index ), options );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected X doExtract(CallableStatement statement, String name, WrapperOptions options) throws SQLException {
|
||||
return javaTypeDescriptor.wrap( statement.getBlob( name ), options );
|
||||
return javaType.wrap( statement.getBlob( name ), options );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> BasicBinder<X> getBinder(final JavaType<X> javaTypeDescriptor) {
|
||||
return new BasicBinder<>( javaTypeDescriptor, this ) {
|
||||
public <X> BasicBinder<X> getBinder(final JavaType<X> javaType) {
|
||||
return new BasicBinder<>( javaType, this ) {
|
||||
|
||||
@Override
|
||||
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
|
||||
|
@ -1661,7 +1661,7 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
else if ( options.useStreamForLobBinding() ) {
|
||||
descriptor = HANABlobType.this.hanaStreamBlobTypeDescriptor;
|
||||
}
|
||||
descriptor.getBinder( javaTypeDescriptor ).bind( st, value, index, options );
|
||||
descriptor.getBinder( javaType ).bind( st, value, index, options );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1674,7 +1674,7 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
else if ( options.useStreamForLobBinding() ) {
|
||||
descriptor = HANABlobType.this.hanaStreamBlobTypeDescriptor;
|
||||
}
|
||||
descriptor.getBinder( javaTypeDescriptor ).bind( st, value, name, options );
|
||||
descriptor.getBinder( javaType ).bind( st, value, name, options );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import org.hibernate.dialect.function.CastingConcatFunction;
|
|||
import org.hibernate.dialect.function.TransactSQLStrFunction;
|
||||
import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
|
||||
import org.hibernate.query.NullOrdering;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.function.CommonFunctionFactory;
|
||||
import org.hibernate.dialect.function.CaseLeastGreatestEmulation;
|
||||
import org.hibernate.dialect.identity.AbstractTransactSQLIdentityColumnSupport;
|
||||
|
@ -31,7 +30,7 @@ import org.hibernate.query.sqm.mutation.spi.SqmMultiTableInsertStrategy;
|
|||
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy;
|
||||
import org.hibernate.sql.ast.SqlAstNodeRenderingMode;
|
||||
import org.hibernate.sql.ast.spi.SqlAppender;
|
||||
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaType;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
|
||||
|
||||
|
@ -382,6 +381,6 @@ public abstract class AbstractTransactSQLDialect extends Dialect {
|
|||
@Override
|
||||
public void appendBinaryLiteral(SqlAppender appender, byte[] bytes) {
|
||||
appender.appendSql( "0x" );
|
||||
PrimitiveByteArrayJavaTypeDescriptor.INSTANCE.appendString( appender, bytes );
|
||||
PrimitiveByteArrayJavaType.INSTANCE.appendString( appender, bytes );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ public class CockroachDialect extends Dialect {
|
|||
super.contributeTypes( typeContributions, serviceRegistry );
|
||||
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
|
||||
.getJdbcTypeDescriptorRegistry();
|
||||
.getJdbcTypeRegistry();
|
||||
if ( driverKind == PostgreSQLDriverKind.PG_JDBC ) {
|
||||
jdbcTypeRegistry.addDescriptorIfAbsent( UUIDJdbcType.INSTANCE );
|
||||
jdbcTypeRegistry.addDescriptorIfAbsent( PostgreSQLIntervalSecondJdbcType.INSTANCE );
|
||||
|
|
|
@ -50,7 +50,7 @@ import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorNo
|
|||
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
|
||||
import org.hibernate.type.JavaObjectType;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaType;
|
||||
import org.hibernate.type.descriptor.jdbc.*;
|
||||
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
|
||||
|
||||
|
@ -558,7 +558,7 @@ public class DB2Dialect extends Dialect {
|
|||
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
|
||||
super.contributeTypes( typeContributions, serviceRegistry );
|
||||
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration().getJdbcTypeDescriptorRegistry();
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration().getJdbcTypeRegistry();
|
||||
|
||||
if ( getVersion().isBefore( 11 ) ) {
|
||||
jdbcTypeRegistry.addDescriptor( Types.BOOLEAN, SmallIntJdbcType.INSTANCE );
|
||||
|
@ -584,14 +584,14 @@ public class DB2Dialect extends Dialect {
|
|||
jdbcTypeRegistry.addDescriptor( Types.NUMERIC, DecimalJdbcType.INSTANCE );
|
||||
|
||||
// DB2 requires a custom binder for binding untyped nulls that resolves the type through the statement
|
||||
typeContributions.contributeJdbcTypeDescriptor( ObjectNullResolvingJdbcType.INSTANCE );
|
||||
typeContributions.contributeJdbcType( ObjectNullResolvingJdbcType.INSTANCE );
|
||||
|
||||
// Until we remove StandardBasicTypes, we have to keep this
|
||||
typeContributions.contributeType(
|
||||
new JavaObjectType(
|
||||
ObjectNullResolvingJdbcType.INSTANCE,
|
||||
typeContributions.getTypeConfiguration()
|
||||
.getJavaTypeDescriptorRegistry()
|
||||
.getJavaTypeRegistry()
|
||||
.getDescriptor( Object.class )
|
||||
)
|
||||
);
|
||||
|
@ -600,7 +600,7 @@ public class DB2Dialect extends Dialect {
|
|||
@Override
|
||||
public void appendBinaryLiteral(SqlAppender appender, byte[] bytes) {
|
||||
appender.appendSql( "BX'" );
|
||||
PrimitiveByteArrayJavaTypeDescriptor.INSTANCE.appendString( appender, bytes );
|
||||
PrimitiveByteArrayJavaType.INSTANCE.appendString( appender, bytes );
|
||||
appender.appendSql( '\'' );
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ import org.hibernate.type.BasicType;
|
|||
import org.hibernate.type.BasicTypeRegistry;
|
||||
import org.hibernate.type.JavaObjectType;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.descriptor.java.BigDecimalJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.BigDecimalJavaType;
|
||||
import org.hibernate.type.descriptor.jdbc.DecimalJdbcType;
|
||||
import org.hibernate.type.descriptor.jdbc.ObjectNullResolvingJdbcType;
|
||||
import org.hibernate.type.descriptor.jdbc.SmallIntJdbcType;
|
||||
|
@ -361,7 +361,7 @@ public class DerbyDialect extends Dialect {
|
|||
case FLOAT:
|
||||
case DOUBLE:
|
||||
// Derby can't cast to char directly, but needs to be cast to decimal first...
|
||||
return "cast(trim(cast(cast(?1 as decimal(" + getDefaultDecimalPrecision() + "," + BigDecimalJavaTypeDescriptor.INSTANCE.getDefaultSqlScale( this, null ) + ")) as char(254))) as ?2)";
|
||||
return "cast(trim(cast(cast(?1 as decimal(" + getDefaultDecimalPrecision() + "," + BigDecimalJavaType.INSTANCE.getDefaultSqlScale( this, null ) + ")) as char(254))) as ?2)";
|
||||
case INTEGER:
|
||||
case LONG:
|
||||
case FIXED:
|
||||
|
@ -542,7 +542,7 @@ public class DerbyDialect extends Dialect {
|
|||
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
|
||||
super.contributeTypes( typeContributions, serviceRegistry );
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
|
||||
.getJdbcTypeDescriptorRegistry();
|
||||
.getJdbcTypeRegistry();
|
||||
if ( getVersion().isBefore( 10, 7 ) ) {
|
||||
jdbcTypeRegistry.addDescriptor( Types.BOOLEAN, SmallIntJdbcType.INSTANCE );
|
||||
}
|
||||
|
@ -550,14 +550,14 @@ public class DerbyDialect extends Dialect {
|
|||
jdbcTypeRegistry.addDescriptor( Types.TIMESTAMP_WITH_TIMEZONE, TimestampJdbcType.INSTANCE );
|
||||
|
||||
// Derby requires a custom binder for binding untyped nulls that resolves the type through the statement
|
||||
typeContributions.contributeJdbcTypeDescriptor( ObjectNullResolvingJdbcType.INSTANCE );
|
||||
typeContributions.contributeJdbcType( ObjectNullResolvingJdbcType.INSTANCE );
|
||||
|
||||
// Until we remove StandardBasicTypes, we have to keep this
|
||||
typeContributions.contributeType(
|
||||
new JavaObjectType(
|
||||
ObjectNullResolvingJdbcType.INSTANCE,
|
||||
typeContributions.getTypeConfiguration()
|
||||
.getJavaTypeDescriptorRegistry()
|
||||
.getJavaTypeRegistry()
|
||||
.getDescriptor( Object.class )
|
||||
)
|
||||
);
|
||||
|
|
|
@ -152,7 +152,7 @@ import org.hibernate.type.SqlTypes;
|
|||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaType;
|
||||
import org.hibernate.type.descriptor.jdbc.ClobJdbcType;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||
import org.hibernate.type.descriptor.jdbc.LongNVarcharJdbcType;
|
||||
|
@ -1313,14 +1313,14 @@ public abstract class Dialect implements ConversionContext {
|
|||
|
||||
final NationalizationSupport nationalizationSupport = getNationalizationSupport();
|
||||
if ( nationalizationSupport == NationalizationSupport.EXPLICIT ) {
|
||||
typeContributions.contributeJdbcTypeDescriptor( NCharJdbcType.INSTANCE );
|
||||
typeContributions.contributeJdbcTypeDescriptor( NVarcharJdbcType.INSTANCE );
|
||||
typeContributions.contributeJdbcTypeDescriptor( LongNVarcharJdbcType.INSTANCE );
|
||||
typeContributions.contributeJdbcTypeDescriptor( NClobJdbcType.DEFAULT );
|
||||
typeContributions.contributeJdbcType( NCharJdbcType.INSTANCE );
|
||||
typeContributions.contributeJdbcType( NVarcharJdbcType.INSTANCE );
|
||||
typeContributions.contributeJdbcType( LongNVarcharJdbcType.INSTANCE );
|
||||
typeContributions.contributeJdbcType( NClobJdbcType.DEFAULT );
|
||||
}
|
||||
|
||||
if ( useInputStreamToInsertBlob() ) {
|
||||
typeContributions.getTypeConfiguration().getJdbcTypeDescriptorRegistry().addDescriptor(
|
||||
typeContributions.getTypeConfiguration().getJdbcTypeRegistry().addDescriptor(
|
||||
Types.CLOB,
|
||||
ClobJdbcType.STREAM_BINDING
|
||||
);
|
||||
|
@ -1432,7 +1432,7 @@ public abstract class Dialect implements ConversionContext {
|
|||
*/
|
||||
public String getCastTypeName(SqlExpressable type, Long length, Integer precision, Integer scale) {
|
||||
final JdbcMapping jdbcMapping = type.getJdbcMapping();
|
||||
final JdbcType jdbcType = jdbcMapping.getJdbcTypeDescriptor();
|
||||
final JdbcType jdbcType = jdbcMapping.getJdbcType();
|
||||
final JavaType<?> javaType = jdbcMapping.getJavaTypeDescriptor();
|
||||
Size size;
|
||||
if ( length == null && precision == null ) {
|
||||
|
@ -3858,7 +3858,7 @@ public abstract class Dialect implements ConversionContext {
|
|||
|
||||
public void appendBinaryLiteral(SqlAppender appender, byte[] bytes) {
|
||||
appender.appendSql( "X'" );
|
||||
PrimitiveByteArrayJavaTypeDescriptor.INSTANCE.appendString( appender, bytes );
|
||||
PrimitiveByteArrayJavaType.INSTANCE.appendString( appender, bytes );
|
||||
appender.appendSql( '\'' );
|
||||
}
|
||||
|
||||
|
|
|
@ -41,10 +41,10 @@ public class DurationIntervalSecondJdbcType implements JdbcType {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T> JdbcLiteralFormatter<T> getJdbcLiteralFormatter(JavaType<T> javaTypeDescriptor) {
|
||||
public <T> JdbcLiteralFormatter<T> getJdbcLiteralFormatter(JavaType<T> javaType) {
|
||||
return (appender, value, dialect, wrapperOptions) -> dialect.appendIntervalLiteral(
|
||||
appender,
|
||||
javaTypeDescriptor.unwrap(
|
||||
javaType.unwrap(
|
||||
value,
|
||||
Duration.class,
|
||||
wrapperOptions
|
||||
|
@ -53,39 +53,39 @@ public class DurationIntervalSecondJdbcType implements JdbcType {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <X> ValueBinder<X> getBinder(JavaType<X> javaTypeDescriptor) {
|
||||
return new BasicBinder<X>( javaTypeDescriptor, this ) {
|
||||
public <X> ValueBinder<X> getBinder(JavaType<X> javaType) {
|
||||
return new BasicBinder<X>( javaType, this ) {
|
||||
@Override
|
||||
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options)
|
||||
throws SQLException {
|
||||
st.setObject( index, javaTypeDescriptor.unwrap( value, Duration.class, options ) );
|
||||
st.setObject( index, javaType.unwrap( value, Duration.class, options ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doBind(CallableStatement st, X value, String name, WrapperOptions options)
|
||||
throws SQLException {
|
||||
st.setObject( name, javaTypeDescriptor.unwrap( value, Duration.class, options ) );
|
||||
st.setObject( name, javaType.unwrap( value, Duration.class, options ) );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> ValueExtractor<X> getExtractor(JavaType<X> javaTypeDescriptor) {
|
||||
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
|
||||
public <X> ValueExtractor<X> getExtractor(JavaType<X> javaType) {
|
||||
return new BasicExtractor<X>( javaType, this ) {
|
||||
@Override
|
||||
protected X doExtract(ResultSet rs, int paramIndex, WrapperOptions options) throws SQLException {
|
||||
return javaTypeDescriptor.wrap( rs.getObject( paramIndex, Duration.class ), options );
|
||||
return javaType.wrap( rs.getObject( paramIndex, Duration.class ), options );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected X doExtract(CallableStatement statement, int index, WrapperOptions options) throws SQLException {
|
||||
return javaTypeDescriptor.wrap( statement.getObject( index, Duration.class ), options );
|
||||
return javaType.wrap( statement.getObject( index, Duration.class ), options );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected X doExtract(CallableStatement statement, String name, WrapperOptions options)
|
||||
throws SQLException {
|
||||
return javaTypeDescriptor.wrap( statement.getObject( name, Duration.class ), options );
|
||||
return javaType.wrap( statement.getObject( name, Duration.class ), options );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ public class H2Dialect extends Dialect {
|
|||
super.contributeTypes( typeContributions, serviceRegistry );
|
||||
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
|
||||
.getJdbcTypeDescriptorRegistry();
|
||||
.getJdbcTypeRegistry();
|
||||
|
||||
if ( getVersion().isSameOrAfter( 1, 4, 197 ) ) {
|
||||
jdbcTypeRegistry.addDescriptorIfAbsent( UUIDJdbcType.INSTANCE );
|
||||
|
|
|
@ -453,21 +453,21 @@ public class MySQLDialect extends Dialect {
|
|||
super.contributeTypes( typeContributions, serviceRegistry );
|
||||
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
|
||||
.getJdbcTypeDescriptorRegistry();
|
||||
.getJdbcTypeRegistry();
|
||||
|
||||
if ( getMySQLVersion().isSameOrAfter( 5, 7 ) ) {
|
||||
jdbcTypeRegistry.addDescriptorIfAbsent( SqlTypes.JSON, JsonJdbcType.INSTANCE );
|
||||
}
|
||||
|
||||
// MySQL requires a custom binder for binding untyped nulls with the NULL type
|
||||
typeContributions.contributeJdbcTypeDescriptor( NullJdbcType.INSTANCE );
|
||||
typeContributions.contributeJdbcType( NullJdbcType.INSTANCE );
|
||||
|
||||
// Until we remove StandardBasicTypes, we have to keep this
|
||||
typeContributions.contributeType(
|
||||
new NullType(
|
||||
NullJdbcType.INSTANCE,
|
||||
typeContributions.getTypeConfiguration()
|
||||
.getJavaTypeDescriptorRegistry()
|
||||
.getJavaTypeRegistry()
|
||||
.getDescriptor( Object.class )
|
||||
)
|
||||
);
|
||||
|
@ -808,7 +808,7 @@ public class MySQLDialect extends Dialect {
|
|||
@Override
|
||||
public String getCastTypeName(SqlExpressable type, Long length, Integer precision, Integer scale) {
|
||||
final JdbcMapping jdbcMapping = type.getJdbcMapping();
|
||||
final JdbcType jdbcType = jdbcMapping.getJdbcTypeDescriptor();
|
||||
final JdbcType jdbcType = jdbcMapping.getJdbcType();
|
||||
final JavaType<?> javaType = jdbcMapping.getJavaTypeDescriptor();
|
||||
switch ( jdbcType.getDefaultSqlTypeCode() ) {
|
||||
case Types.INTEGER:
|
||||
|
|
|
@ -74,7 +74,7 @@ import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
|
|||
import org.hibernate.type.JavaObjectType;
|
||||
import org.hibernate.type.NullType;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaType;
|
||||
import org.hibernate.type.descriptor.jdbc.BlobJdbcType;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||
import org.hibernate.type.descriptor.jdbc.NullJdbcType;
|
||||
|
@ -692,19 +692,19 @@ public class OracleDialect extends Dialect {
|
|||
BlobJdbcType.PRIMITIVE_ARRAY_BINDING :
|
||||
BlobJdbcType.DEFAULT;
|
||||
|
||||
typeContributions.contributeJdbcTypeDescriptor( descriptor );
|
||||
typeContributions.contributeJdbcType( descriptor );
|
||||
}
|
||||
|
||||
// Oracle requires a custom binder for binding untyped nulls with the NULL type
|
||||
typeContributions.contributeJdbcTypeDescriptor( NullJdbcType.INSTANCE );
|
||||
typeContributions.contributeJdbcTypeDescriptor( ObjectNullAsNullTypeJdbcType.INSTANCE );
|
||||
typeContributions.contributeJdbcType( NullJdbcType.INSTANCE );
|
||||
typeContributions.contributeJdbcType( ObjectNullAsNullTypeJdbcType.INSTANCE );
|
||||
|
||||
// Until we remove StandardBasicTypes, we have to keep this
|
||||
typeContributions.contributeType(
|
||||
new NullType(
|
||||
NullJdbcType.INSTANCE,
|
||||
typeContributions.getTypeConfiguration()
|
||||
.getJavaTypeDescriptorRegistry()
|
||||
.getJavaTypeRegistry()
|
||||
.getDescriptor( Object.class )
|
||||
)
|
||||
);
|
||||
|
@ -712,7 +712,7 @@ public class OracleDialect extends Dialect {
|
|||
new JavaObjectType(
|
||||
ObjectNullAsNullTypeJdbcType.INSTANCE,
|
||||
typeContributions.getTypeConfiguration()
|
||||
.getJavaTypeDescriptorRegistry()
|
||||
.getJavaTypeRegistry()
|
||||
.getDescriptor( Object.class )
|
||||
)
|
||||
);
|
||||
|
@ -1240,7 +1240,7 @@ public class OracleDialect extends Dialect {
|
|||
@Override
|
||||
public void appendBinaryLiteral(SqlAppender appender, byte[] bytes) {
|
||||
appender.appendSql( "hextoraw('" );
|
||||
PrimitiveByteArrayJavaTypeDescriptor.INSTANCE.appendString( appender, bytes );
|
||||
PrimitiveByteArrayJavaType.INSTANCE.appendString( appender, bytes );
|
||||
appender.appendSql( "')" );
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ import org.hibernate.sql.ast.spi.StandardSqlAstTranslatorFactory;
|
|||
import org.hibernate.sql.ast.tree.Statement;
|
||||
import org.hibernate.sql.exec.spi.JdbcOperation;
|
||||
import org.hibernate.type.JavaObjectType;
|
||||
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaType;
|
||||
import org.hibernate.type.descriptor.jdbc.BlobJdbcType;
|
||||
import org.hibernate.type.descriptor.jdbc.ClobJdbcType;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||
|
@ -842,7 +842,7 @@ public class PostgreSQLDialect extends Dialect {
|
|||
@Override
|
||||
public void appendBinaryLiteral(SqlAppender appender, byte[] bytes) {
|
||||
appender.appendSql( "bytea '\\x" );
|
||||
PrimitiveByteArrayJavaTypeDescriptor.INSTANCE.appendString( appender, bytes );
|
||||
PrimitiveByteArrayJavaType.INSTANCE.appendString( appender, bytes );
|
||||
appender.appendSql( '\'' );
|
||||
}
|
||||
|
||||
|
@ -1051,7 +1051,7 @@ public class PostgreSQLDialect extends Dialect {
|
|||
super.contributeTypes(typeContributions, serviceRegistry);
|
||||
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
|
||||
.getJdbcTypeDescriptorRegistry();
|
||||
.getJdbcTypeRegistry();
|
||||
// For discussion of BLOB support in Postgres, as of 8.4, have a peek at
|
||||
// <a href="http://jdbc.postgresql.org/documentation/84/binary-data.html">http://jdbc.postgresql.org/documentation/84/binary-data.html</a>.
|
||||
// For the effects in regards to Hibernate see <a href="http://in.relation.to/15492.lace">http://in.relation.to/15492.lace</a>
|
||||
|
@ -1077,14 +1077,14 @@ public class PostgreSQLDialect extends Dialect {
|
|||
}
|
||||
|
||||
// PostgreSQL requires a custom binder for binding untyped nulls as VARBINARY
|
||||
typeContributions.contributeJdbcTypeDescriptor( ObjectNullAsBinaryTypeJdbcType.INSTANCE );
|
||||
typeContributions.contributeJdbcType( ObjectNullAsBinaryTypeJdbcType.INSTANCE );
|
||||
|
||||
// Until we remove StandardBasicTypes, we have to keep this
|
||||
typeContributions.contributeType(
|
||||
new JavaObjectType(
|
||||
ObjectNullAsBinaryTypeJdbcType.INSTANCE,
|
||||
typeContributions.getTypeConfiguration()
|
||||
.getJavaTypeDescriptorRegistry()
|
||||
.getJavaTypeRegistry()
|
||||
.getDescriptor( Object.class )
|
||||
)
|
||||
);
|
||||
|
|
|
@ -22,7 +22,7 @@ public class PostgreSQLInetJdbcType extends PostgreSQLPGObjectJdbcType {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected <X> X fromString(String string, JavaType<X> javaTypeDescriptor, WrapperOptions options) {
|
||||
protected <X> X fromString(String string, JavaType<X> javaType, WrapperOptions options) {
|
||||
final String host;
|
||||
if ( string == null ) {
|
||||
host = null;
|
||||
|
@ -37,6 +37,6 @@ public class PostgreSQLInetJdbcType extends PostgreSQLPGObjectJdbcType {
|
|||
host = string.substring( 0, slashIndex );
|
||||
}
|
||||
}
|
||||
return javaTypeDescriptor.wrap( host, options );
|
||||
return javaType.wrap( host, options );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.hibernate.type.descriptor.jdbc.BasicBinder;
|
|||
import org.hibernate.type.descriptor.jdbc.BasicExtractor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcLiteralFormatter;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
|
||||
|
||||
/**
|
||||
* @author Christian Beikov
|
||||
|
@ -69,19 +69,19 @@ public class PostgreSQLIntervalSecondJdbcType implements AdjustableJdbcType {
|
|||
}
|
||||
|
||||
@Override
|
||||
public JdbcType resolveIndicatedType(JdbcTypeDescriptorIndicators indicators, JavaType<?> domainJtd) {
|
||||
public JdbcType resolveIndicatedType(JdbcTypeIndicators indicators, JavaType<?> domainJtd) {
|
||||
// The default scale is 9
|
||||
if ( indicators.getColumnScale() == JdbcTypeDescriptorIndicators.NO_COLUMN_SCALE || indicators.getColumnScale() > 6 ) {
|
||||
return indicators.getTypeConfiguration().getJdbcTypeDescriptorRegistry().getDescriptor( SqlTypes.NUMERIC );
|
||||
if ( indicators.getColumnScale() == JdbcTypeIndicators.NO_COLUMN_SCALE || indicators.getColumnScale() > 6 ) {
|
||||
return indicators.getTypeConfiguration().getJdbcTypeRegistry().getDescriptor( SqlTypes.NUMERIC );
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> JdbcLiteralFormatter<T> getJdbcLiteralFormatter(JavaType<T> javaTypeDescriptor) {
|
||||
public <T> JdbcLiteralFormatter<T> getJdbcLiteralFormatter(JavaType<T> javaType) {
|
||||
return (appender, value, dialect, wrapperOptions) -> dialect.appendIntervalLiteral(
|
||||
appender,
|
||||
javaTypeDescriptor.unwrap(
|
||||
javaType.unwrap(
|
||||
value,
|
||||
Duration.class,
|
||||
wrapperOptions
|
||||
|
@ -90,19 +90,19 @@ public class PostgreSQLIntervalSecondJdbcType implements AdjustableJdbcType {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <X> ValueBinder<X> getBinder(JavaType<X> javaTypeDescriptor) {
|
||||
return new BasicBinder<X>( javaTypeDescriptor, this ) {
|
||||
public <X> ValueBinder<X> getBinder(JavaType<X> javaType) {
|
||||
return new BasicBinder<X>( javaType, this ) {
|
||||
@Override
|
||||
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options)
|
||||
throws SQLException {
|
||||
final Duration duration = getJavaTypeDescriptor().unwrap( value, Duration.class, options );
|
||||
final Duration duration = getJavaType().unwrap( value, Duration.class, options );
|
||||
st.setObject( index, constructInterval( duration ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doBind(CallableStatement st, X value, String name, WrapperOptions options)
|
||||
throws SQLException {
|
||||
final Duration duration = getJavaTypeDescriptor().unwrap( value, Duration.class, options );
|
||||
final Duration duration = getJavaType().unwrap( value, Duration.class, options );
|
||||
st.setObject( name, constructInterval( duration ) );
|
||||
}
|
||||
|
||||
|
@ -135,22 +135,22 @@ public class PostgreSQLIntervalSecondJdbcType implements AdjustableJdbcType {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <X> ValueExtractor<X> getExtractor(JavaType<X> javaTypeDescriptor) {
|
||||
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
|
||||
public <X> ValueExtractor<X> getExtractor(JavaType<X> javaType) {
|
||||
return new BasicExtractor<X>( javaType, this ) {
|
||||
@Override
|
||||
protected X doExtract(ResultSet rs, int paramIndex, WrapperOptions options) throws SQLException {
|
||||
return getJavaTypeDescriptor().wrap( rs.getString( paramIndex ), options );
|
||||
return getJavaType().wrap( rs.getString( paramIndex ), options );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected X doExtract(CallableStatement statement, int index, WrapperOptions options) throws SQLException {
|
||||
return getJavaTypeDescriptor().wrap( statement.getString( index ), options );
|
||||
return getJavaType().wrap( statement.getString( index ), options );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected X doExtract(CallableStatement statement, String name, WrapperOptions options)
|
||||
throws SQLException {
|
||||
return getJavaTypeDescriptor().wrap( statement.getString( name ), options );
|
||||
return getJavaType().wrap( statement.getString( name ), options );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -22,19 +22,19 @@ public class PostgreSQLJsonJdbcType extends PostgreSQLPGObjectJdbcType {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected <X> X fromString(String string, JavaType<X> javaTypeDescriptor, WrapperOptions options) {
|
||||
protected <X> X fromString(String string, JavaType<X> javaType, WrapperOptions options) {
|
||||
return options.getSessionFactory().getFastSessionServices().getJsonFormatMapper().fromString(
|
||||
string,
|
||||
javaTypeDescriptor,
|
||||
javaType,
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected <X> String toString(X value, JavaType<X> javaTypeDescriptor, WrapperOptions options) {
|
||||
protected <X> String toString(X value, JavaType<X> javaType, WrapperOptions options) {
|
||||
return options.getSessionFactory().getFastSessionServices().getJsonFormatMapper().toString(
|
||||
value,
|
||||
javaTypeDescriptor,
|
||||
javaType,
|
||||
options
|
||||
);
|
||||
}
|
||||
|
|
|
@ -22,19 +22,19 @@ public class PostgreSQLJsonbJdbcType extends PostgreSQLPGObjectJdbcType {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected <X> X fromString(String string, JavaType<X> javaTypeDescriptor, WrapperOptions options) {
|
||||
protected <X> X fromString(String string, JavaType<X> javaType, WrapperOptions options) {
|
||||
return options.getSessionFactory().getFastSessionServices().getJsonFormatMapper().fromString(
|
||||
string,
|
||||
javaTypeDescriptor,
|
||||
javaType,
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected <X> String toString(X value, JavaType<X> javaTypeDescriptor, WrapperOptions options) {
|
||||
protected <X> String toString(X value, JavaType<X> javaType, WrapperOptions options) {
|
||||
return options.getSessionFactory().getFastSessionServices().getJsonFormatMapper().toString(
|
||||
value,
|
||||
javaTypeDescriptor,
|
||||
javaType,
|
||||
options
|
||||
);
|
||||
}
|
||||
|
|
|
@ -73,23 +73,23 @@ public abstract class PostgreSQLPGObjectJdbcType implements JdbcType {
|
|||
return sqlTypeCode;
|
||||
}
|
||||
|
||||
protected <X> X fromString(String string, JavaType<X> javaTypeDescriptor, WrapperOptions options) {
|
||||
return javaTypeDescriptor.wrap( string, options );
|
||||
protected <X> X fromString(String string, JavaType<X> javaType, WrapperOptions options) {
|
||||
return javaType.wrap( string, options );
|
||||
}
|
||||
|
||||
protected <X> String toString(X value, JavaType<X> javaTypeDescriptor, WrapperOptions options) {
|
||||
return javaTypeDescriptor.unwrap( value, String.class, options );
|
||||
protected <X> String toString(X value, JavaType<X> javaType, WrapperOptions options) {
|
||||
return javaType.unwrap( value, String.class, options );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> ValueBinder<X> getBinder(JavaType<X> javaTypeDescriptor) {
|
||||
return new BasicBinder<X>( javaTypeDescriptor, this ) {
|
||||
public <X> ValueBinder<X> getBinder(JavaType<X> javaType) {
|
||||
return new BasicBinder<X>( javaType, this ) {
|
||||
@Override
|
||||
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options)
|
||||
throws SQLException {
|
||||
final String stringValue = ( (PostgreSQLPGObjectJdbcType) getJdbcTypeDescriptor() ).toString(
|
||||
final String stringValue = ( (PostgreSQLPGObjectJdbcType) getJdbcType() ).toString(
|
||||
value,
|
||||
getJavaTypeDescriptor(),
|
||||
getJavaType(),
|
||||
options
|
||||
);
|
||||
try {
|
||||
|
@ -106,9 +106,9 @@ public abstract class PostgreSQLPGObjectJdbcType implements JdbcType {
|
|||
@Override
|
||||
protected void doBind(CallableStatement st, X value, String name, WrapperOptions options)
|
||||
throws SQLException {
|
||||
final String stringValue = ( (PostgreSQLPGObjectJdbcType) getJdbcTypeDescriptor() ).toString(
|
||||
final String stringValue = ( (PostgreSQLPGObjectJdbcType) getJdbcType() ).toString(
|
||||
value,
|
||||
getJavaTypeDescriptor(),
|
||||
getJavaType(),
|
||||
options
|
||||
);
|
||||
try {
|
||||
|
@ -125,22 +125,22 @@ public abstract class PostgreSQLPGObjectJdbcType implements JdbcType {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <X> ValueExtractor<X> getExtractor(JavaType<X> javaTypeDescriptor) {
|
||||
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
|
||||
public <X> ValueExtractor<X> getExtractor(JavaType<X> javaType) {
|
||||
return new BasicExtractor<X>( javaType, this ) {
|
||||
@Override
|
||||
protected X doExtract(ResultSet rs, int paramIndex, WrapperOptions options) throws SQLException {
|
||||
return ( (PostgreSQLPGObjectJdbcType) getJdbcTypeDescriptor() ).fromString(
|
||||
return ( (PostgreSQLPGObjectJdbcType) getJdbcType() ).fromString(
|
||||
rs.getString( paramIndex ),
|
||||
getJavaTypeDescriptor(),
|
||||
getJavaType(),
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected X doExtract(CallableStatement statement, int index, WrapperOptions options) throws SQLException {
|
||||
return ( (PostgreSQLPGObjectJdbcType) getJdbcTypeDescriptor() ).fromString(
|
||||
return ( (PostgreSQLPGObjectJdbcType) getJdbcType() ).fromString(
|
||||
statement.getString( index ),
|
||||
getJavaTypeDescriptor(),
|
||||
getJavaType(),
|
||||
options
|
||||
);
|
||||
}
|
||||
|
@ -148,9 +148,9 @@ public abstract class PostgreSQLPGObjectJdbcType implements JdbcType {
|
|||
@Override
|
||||
protected X doExtract(CallableStatement statement, String name, WrapperOptions options)
|
||||
throws SQLException {
|
||||
return ( (PostgreSQLPGObjectJdbcType) getJdbcTypeDescriptor() ).fromString(
|
||||
return ( (PostgreSQLPGObjectJdbcType) getJdbcType() ).fromString(
|
||||
statement.getString( name ),
|
||||
getJavaTypeDescriptor(),
|
||||
getJavaType(),
|
||||
options
|
||||
);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ import org.hibernate.tool.schema.spi.Exporter;
|
|||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.BasicTypeRegistry;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaType;
|
||||
import org.hibernate.type.descriptor.jdbc.SmallIntJdbcType;
|
||||
|
||||
import java.sql.DatabaseMetaData;
|
||||
|
@ -194,7 +194,7 @@ public class SQLServerDialect extends AbstractTransactSQLDialect {
|
|||
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
|
||||
super.contributeTypes( typeContributions, serviceRegistry );
|
||||
|
||||
typeContributions.getTypeConfiguration().getJdbcTypeDescriptorRegistry().addDescriptor(
|
||||
typeContributions.getTypeConfiguration().getJdbcTypeRegistry().addDescriptor(
|
||||
Types.TINYINT,
|
||||
SmallIntJdbcType.INSTANCE
|
||||
);
|
||||
|
@ -751,7 +751,7 @@ public class SQLServerDialect extends AbstractTransactSQLDialect {
|
|||
@Override
|
||||
public void appendBinaryLiteral(SqlAppender appender, byte[] bytes) {
|
||||
appender.appendSql( "0x" );
|
||||
PrimitiveByteArrayJavaTypeDescriptor.INSTANCE.appendString( appender, bytes );
|
||||
PrimitiveByteArrayJavaType.INSTANCE.appendString( appender, bytes );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -801,7 +801,7 @@ public class SpannerDialect extends Dialect {
|
|||
@Override
|
||||
public String getCastTypeName(SqlExpressable type, Long length, Integer precision, Integer scale) {
|
||||
//Spanner doesn't let you specify a length in cast() types
|
||||
return super.getRawTypeName( type.getJdbcMapping().getJdbcTypeDescriptor() );
|
||||
return super.getRawTypeName( type.getJdbcMapping().getJdbcType() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -212,7 +212,7 @@ public class SybaseASEDialect extends SybaseDialect {
|
|||
super.contributeTypes( typeContributions, serviceRegistry );
|
||||
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
|
||||
.getJdbcTypeDescriptorRegistry();
|
||||
.getJdbcTypeRegistry();
|
||||
jdbcTypeRegistry.addDescriptor( Types.BOOLEAN, TinyIntJdbcType.INSTANCE );
|
||||
// At least the jTDS driver does not support this type code
|
||||
if ( jtdsDriver ) {
|
||||
|
|
|
@ -161,7 +161,7 @@ public class SybaseDialect extends AbstractTransactSQLDialect {
|
|||
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
|
||||
super.contributeTypes(typeContributions, serviceRegistry);
|
||||
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
|
||||
.getJdbcTypeDescriptorRegistry();
|
||||
.getJdbcTypeRegistry();
|
||||
if ( jtdsDriver ) {
|
||||
jdbcTypeRegistry.addDescriptor( Types.TINYINT, SmallIntJdbcType.INSTANCE );
|
||||
|
||||
|
@ -180,14 +180,14 @@ public class SybaseDialect extends AbstractTransactSQLDialect {
|
|||
jdbcTypeRegistry.addDescriptor( Types.BLOB, BlobJdbcType.PRIMITIVE_ARRAY_BINDING );
|
||||
|
||||
// Sybase requires a custom binder for binding untyped nulls with the NULL type
|
||||
typeContributions.contributeJdbcTypeDescriptor( ObjectNullAsNullTypeJdbcType.INSTANCE );
|
||||
typeContributions.contributeJdbcType( ObjectNullAsNullTypeJdbcType.INSTANCE );
|
||||
|
||||
// Until we remove StandardBasicTypes, we have to keep this
|
||||
typeContributions.contributeType(
|
||||
new JavaObjectType(
|
||||
ObjectNullAsNullTypeJdbcType.INSTANCE,
|
||||
typeContributions.getTypeConfiguration()
|
||||
.getJavaTypeDescriptorRegistry()
|
||||
.getJavaTypeRegistry()
|
||||
.getDescriptor( Object.class )
|
||||
)
|
||||
);
|
||||
|
|
|
@ -100,7 +100,7 @@ public class AvgFunction extends AbstractSqmSelfRenderingFunctionDescriptor {
|
|||
private void renderArgument(SqlAppender sqlAppender, SqlAstTranslator<?> translator, Expression realArg) {
|
||||
final JdbcMapping sourceMapping = realArg.getExpressionType().getJdbcMappings().get( 0 );
|
||||
// Only cast to float/double if this is an integer
|
||||
if ( sourceMapping.getJdbcTypeDescriptor().isInteger() ) {
|
||||
if ( sourceMapping.getJdbcType().isInteger() ) {
|
||||
final String cast = dialect.castPattern( sourceMapping.getCastType(), CastType.DOUBLE );
|
||||
new PatternRenderer( cast.replace( "?2", doubleCastType ) )
|
||||
.render( sqlAppender, Collections.singletonList( realArg ), translator );
|
||||
|
|
|
@ -53,8 +53,8 @@ public class CastingConcatFunction extends AbstractSqmSelfRenderingFunctionDescr
|
|||
this.concatArgumentCastType = dialect.getTypeName(
|
||||
SqlTypes.VARCHAR,
|
||||
dialect.getSizeStrategy().resolveSize(
|
||||
typeConfiguration.getJdbcTypeDescriptorRegistry().getDescriptor( SqlTypes.VARCHAR ),
|
||||
typeConfiguration.getJavaTypeDescriptorRegistry().getDescriptor( String.class ),
|
||||
typeConfiguration.getJdbcTypeRegistry().getDescriptor( SqlTypes.VARCHAR ),
|
||||
typeConfiguration.getJavaTypeRegistry().getDescriptor( String.class ),
|
||||
null,
|
||||
null,
|
||||
null
|
||||
|
|
|
@ -1917,7 +1917,7 @@ public class CommonFunctionFactory {
|
|||
return impliedType;
|
||||
}
|
||||
}
|
||||
switch ( basicType.getJdbcTypeDescriptor().getJdbcTypeCode() ) {
|
||||
switch ( basicType.getJdbcType().getJdbcTypeCode() ) {
|
||||
case Types.SMALLINT:
|
||||
case Types.TINYINT:
|
||||
case Types.INTEGER:
|
||||
|
@ -1954,7 +1954,7 @@ public class CommonFunctionFactory {
|
|||
arguments,
|
||||
1
|
||||
);
|
||||
switch ( specifiedArgType.getJdbcMapping().getJdbcTypeDescriptor().getJdbcTypeCode() ) {
|
||||
switch ( specifiedArgType.getJdbcMapping().getJdbcType().getJdbcTypeCode() ) {
|
||||
case Types.SMALLINT:
|
||||
case Types.TINYINT:
|
||||
case Types.INTEGER:
|
||||
|
@ -2447,10 +2447,10 @@ public class CommonFunctionFactory {
|
|||
final JdbcMapping powerType = StandardFunctionReturnTypeResolvers
|
||||
.extractArgumentJdbcMapping( typeConfiguration, arguments, 2 );
|
||||
|
||||
if ( baseType.getJdbcTypeDescriptor().isDecimal() ) {
|
||||
if ( baseType.getJdbcType().isDecimal() ) {
|
||||
return (ReturnableType<?>) arguments.get( 0 ).getNodeType();
|
||||
}
|
||||
else if ( powerType.getJdbcTypeDescriptor().isDecimal() ) {
|
||||
else if ( powerType.getJdbcType().isDecimal() ) {
|
||||
return (ReturnableType<?>) arguments.get( 1 ).getNodeType();
|
||||
}
|
||||
return typeConfiguration.getBasicTypeForJavaType( Double.class );
|
||||
|
@ -2467,10 +2467,10 @@ public class CommonFunctionFactory {
|
|||
arguments,
|
||||
2
|
||||
);
|
||||
if ( baseMapping.getJdbcMapping().getJdbcTypeDescriptor().isDecimal() ) {
|
||||
if ( baseMapping.getJdbcMapping().getJdbcType().isDecimal() ) {
|
||||
return baseMapping;
|
||||
}
|
||||
else if ( powerMapping.getJdbcMapping().getJdbcTypeDescriptor().isDecimal() ) {
|
||||
else if ( powerMapping.getJdbcMapping().getJdbcType().isDecimal() ) {
|
||||
return powerMapping;
|
||||
}
|
||||
return doubleType;
|
||||
|
|
|
@ -79,7 +79,7 @@ public class TimestampaddFunction
|
|||
else {
|
||||
final Expression magnitude = (Expression) arguments.get( 1 );
|
||||
final JdbcMapping magnitudeJdbcMapping = magnitude.getExpressionType().getJdbcMappings().get( 0 );
|
||||
switch ( magnitudeJdbcMapping.getJdbcTypeDescriptor().getJdbcTypeCode() ) {
|
||||
switch ( magnitudeJdbcMapping.getJdbcType().getJdbcTypeCode() ) {
|
||||
case Types.INTEGER:
|
||||
case Types.TINYINT:
|
||||
case Types.SMALLINT:
|
||||
|
@ -87,7 +87,7 @@ public class TimestampaddFunction
|
|||
unit = field.getUnit();
|
||||
break;
|
||||
default:
|
||||
if ( magnitudeJdbcMapping.getMappedJavaTypeDescriptor().getJavaTypeClass() == Duration.class ) {
|
||||
if ( magnitudeJdbcMapping.getMappedJavaType().getJavaTypeClass() == Duration.class ) {
|
||||
// Don't scale durations
|
||||
unit = field.getUnit();
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ public class TimestampaddFunction
|
|||
? BinaryArithmeticOperator.MULTIPLY
|
||||
: BinaryArithmeticOperator.DIVIDE,
|
||||
new QueryLiteral<>(
|
||||
expressionType.getExpressableJavaTypeDescriptor()
|
||||
expressionType.getExpressableJavaType()
|
||||
.fromString( conversionFactor.substring( 1 ) ),
|
||||
expressionType
|
||||
),
|
||||
|
|
|
@ -46,7 +46,7 @@ public class StandardTemporaryTableExporter implements TemporaryTableExporter {
|
|||
|
||||
for ( TemporaryTableColumn column : temporaryTable.getColumns() ) {
|
||||
buffer.append( column.getColumnName() ).append( ' ' );
|
||||
final int sqlTypeCode = column.getJdbcMapping().getJdbcTypeDescriptor().getDefaultSqlTypeCode();
|
||||
final int sqlTypeCode = column.getJdbcMapping().getJdbcType().getDefaultSqlTypeCode();
|
||||
final String databaseTypeName = column.getSqlTypeDefinition();
|
||||
|
||||
buffer.append( databaseTypeName );
|
||||
|
|
|
@ -90,9 +90,9 @@ public class TemporaryTable implements Exportable, Contributable {
|
|||
this,
|
||||
uuidType,
|
||||
dialect.getTypeName(
|
||||
uuidType.getJdbcTypeDescriptor(),
|
||||
uuidType.getJdbcType(),
|
||||
dialect.getSizeStrategy().resolveSize(
|
||||
uuidType.getJdbcTypeDescriptor(),
|
||||
uuidType.getJdbcType(),
|
||||
uuidType.getJavaTypeDescriptor(),
|
||||
null,
|
||||
null,
|
||||
|
@ -312,9 +312,9 @@ public class TemporaryTable implements Exportable, Contributable {
|
|||
final String rowNumberType;
|
||||
if ( dialect.supportsWindowFunctions() ) {
|
||||
rowNumberType = dialect.getTypeName(
|
||||
integerBasicType.getJdbcTypeDescriptor().getJdbcTypeCode(),
|
||||
integerBasicType.getJdbcType().getJdbcTypeCode(),
|
||||
dialect.getSizeStrategy().resolveSize(
|
||||
integerBasicType.getJdbcTypeDescriptor(),
|
||||
integerBasicType.getJdbcType(),
|
||||
integerBasicType.getJavaTypeDescriptor(),
|
||||
null,
|
||||
null,
|
||||
|
@ -324,23 +324,23 @@ public class TemporaryTable implements Exportable, Contributable {
|
|||
}
|
||||
else if ( dialect.getIdentityColumnSupport().supportsIdentityColumns() ) {
|
||||
rowNumberType = dialect.getTypeName(
|
||||
integerBasicType.getJdbcTypeDescriptor().getJdbcTypeCode(),
|
||||
integerBasicType.getJdbcType().getJdbcTypeCode(),
|
||||
dialect.getSizeStrategy().resolveSize(
|
||||
integerBasicType.getJdbcTypeDescriptor(),
|
||||
integerBasicType.getJdbcType(),
|
||||
integerBasicType.getJavaTypeDescriptor(),
|
||||
null,
|
||||
null,
|
||||
null
|
||||
)
|
||||
) + " " +
|
||||
dialect.getIdentityColumnSupport().getIdentityColumnString( integerBasicType.getJdbcTypeDescriptor().getJdbcTypeCode() );
|
||||
dialect.getIdentityColumnSupport().getIdentityColumnString( integerBasicType.getJdbcType().getJdbcTypeCode() );
|
||||
}
|
||||
else {
|
||||
LOG.multiTableInsertNotAvailable( entityBinding.getEntityName() );
|
||||
rowNumberType = dialect.getTypeName(
|
||||
integerBasicType.getJdbcTypeDescriptor().getJdbcTypeCode(),
|
||||
integerBasicType.getJdbcType().getJdbcTypeCode(),
|
||||
dialect.getSizeStrategy().resolveSize(
|
||||
integerBasicType.getJdbcTypeDescriptor(),
|
||||
integerBasicType.getJdbcType(),
|
||||
integerBasicType.getJavaTypeDescriptor(),
|
||||
null,
|
||||
null,
|
||||
|
|
|
@ -410,7 +410,7 @@ public abstract class AbstractSaveEventListener
|
|||
substitute = Versioning.seedVersion(
|
||||
values,
|
||||
persister.getVersionProperty(),
|
||||
persister.getVersionJavaTypeDescriptor(),
|
||||
persister.getVersionJavaType(),
|
||||
source
|
||||
) || substitute;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue