HHH-14524 : Rename SqlType(X) as JdbcType(X)

This commit is contained in:
Steve Ebersole 2021-03-23 15:41:58 -05:00
parent a02835bdde
commit 7fcde66d61
294 changed files with 1275 additions and 1394 deletions

View File

@ -7,9 +7,9 @@ Changes in 6.0 worth documenting in various places
Document in release-notes: Document in release-notes:
* `@SqlTypeCode` * `@JdbcTypeCode`
* `@SqlType` * `@JdbcType`
* `@SqlTypeRegistration` * `@JdbcTypeRegistration`
* `@JavaType` * `@JavaType`
* `@JavaTypeRegistration` * `@JavaTypeRegistration`
* `NativeQuery#addScalar(Class)` * `NativeQuery#addScalar(Class)`

View File

@ -68,7 +68,7 @@ troubleshooting device. Some log categories of particular interest include:
|org.hibernate.SQL |org.hibernate.SQL
|Log all SQL statements as they are executed with through JDBC |Log all SQL statements as they are executed with through JDBC
|org.hibernate.type.descriptor.sql |org.hibernate.type.descriptor.jdbc
|Log all values as they are bound to JDBC parameters and extracted from JDBC results |Log all values as they are bound to JDBC parameters and extracted from JDBC results
|org.hibernate.tool.hbm2ddl |org.hibernate.tool.hbm2ddl

View File

@ -36,7 +36,7 @@ log4j.logger.org.hibernate.SQL=debug
### log JDBC bind parameters ### ### log JDBC bind parameters ###
log4j.logger.org.hibernate.type=trace log4j.logger.org.hibernate.type=trace
log4j.logger.org.hibernate.type.descriptor.sql=trace log4j.logger.org.hibernate.type.descriptor.jdbc=trace
---- ----
However, there are some other alternatives like using datasource-proxy or p6spy. However, there are some other alternatives like using datasource-proxy or p6spy.

View File

@ -276,8 +276,8 @@ include::{sourcedir}/basic/BitSetType.java[tags=basic-custom-type-BitSetType-exa
---- ----
==== ====
The `AbstractSingleColumnStandardBasicType` requires an `sqlTypeDescriptor` and a `javaTypeDescriptor`. The `AbstractSingleColumnStandardBasicType` requires an `jdbcTypeDescriptor` and a `javaTypeDescriptor`.
The `sqlTypeDescriptor` is `VarcharTypeDescriptor.INSTANCE` because the database column is a VARCHAR. The `jdbcTypeDescriptor` is `VarcharTypeDescriptor.INSTANCE` because the database column is a VARCHAR.
On the Java side, we need to use a `BitSetTypeDescriptor` instance which can be implemented like this: On the Java side, we need to use a `BitSetTypeDescriptor` instance which can be implemented like this:
[[basic-custom-type-BitSetTypeDescriptor-example]] [[basic-custom-type-BitSetTypeDescriptor-example]]

View File

@ -2,12 +2,12 @@
=== JDBC Mappings === JDBC Mappings
Historically Hibernate's BasicType / UserType system is based on a static binding between a Java type Historically Hibernate's BasicType / UserType system is based on a static binding between a Java type
(`JavaTypeDescriptor`) and a SQL/JDBC type (`SqlTypeDescriptor`). 6.0 introduces the ability to influence (`JavaTypeDescriptor`) and a SQL/JDBC type (`JdbcTypeDescriptor`). 6.0 introduces the ability to influence
the `JavaTypeDescriptor` and `SqlTypeDescriptor` independently. Under this new approach, the resolution of a the `JavaTypeDescriptor` and `JdbcTypeDescriptor` independently. Under this new approach, the resolution of a
basic value mapping comes down to: basic value mapping comes down to:
* `JavaTypeDescriptor` to use * `JavaTypeDescriptor` to use
* `SqlTypeDescriptor` to use * `JdbcTypeDescriptor` to use
* `BasicValueConverter` to use (if one) * `BasicValueConverter` to use (if one)
* `MutabilityPlan` to use * `MutabilityPlan` to use
@ -29,13 +29,13 @@ An `AttributeConverter` can also influence the `JavaTypeDescriptor` used in cert
==== SqlTypeDescriptor ==== SqlTypeDescriptor
`@SqlType` can be used to explicitly specify the `SqlTypeDescriptor` to use for a particular mapping. `JdbcType` can be used to explicitly specify the `JdbcTypeDescriptor` to use for a particular mapping.
`@SqlTypeCode` can be used to indicate the `SqlTypeDescriptorRegistry` entry to use. `@SqlTypeRegistration` can `JdbcTypeCode` can be used to indicate the `JdbcTypeDescriptorRegistry` entry to use. `JdbcTypeRegistration` can
be used to register a `SqlTypeDescriptor` with the `SqlTypeDescriptorRegistry`. be used to register a `JdbcTypeDescriptor` with the `JdbcTypeDescriptorRegistry`.
`@MapKeySqlType` and `@MapKeySqlTypeCode` work the same as `@SqlType` and `@SqlTypeCode`, respectively, except `MapKeyJdbcType` and `MapKeyJdbcTypeCode` work the same as `JdbcType` and `JdbcTypeCode`, respectively, except
describing the `SqlTypeDescriptor` to use for the map's key. In which case, `@SqlType` and `@SqlTypeCode` refer describing the `JdbcTypeDescriptor` to use for the map's key. In which case, `JdbcType` and `JdbcTypeCode` refer
to the map's values. to the map's values.
For character and binary data, the JPA `@Lob` annotation can be used to indicate that a JDBC BLOB, CLOB, NCLOB should For character and binary data, the JPA `@Lob` annotation can be used to indicate that a JDBC BLOB, CLOB, NCLOB should
@ -44,12 +44,12 @@ be used.
For character data, `@Nationalized` can be used to indicate that the JDBC nationalized variant should be used. For character data, `@Nationalized` can be used to indicate that the JDBC nationalized variant should be used.
E.g. `Types.CLOB` -> `Types.CLOB`, `Types.VARCHAR` -> `Types.NVARCHAR`, etc E.g. `Types.CLOB` -> `Types.CLOB`, `Types.VARCHAR` -> `Types.NVARCHAR`, etc
`@Enumerated` influences the `SqlTypeDescriptor` to use by the `EnumType` specified. `EnumType#ORDINAL` implies `@Enumerated` influences the `JdbcTypeDescriptor` to use by the `EnumType` specified. `EnumType#ORDINAL` implies
that `Types.TINYINT` should be used. `EnumType#STRING` implies that `Types.VARCHAR` should be used. that `Types.TINYINT` should be used. `EnumType#STRING` implies that `Types.VARCHAR` should be used.
`@Temporal` can also influence the `SqlTypeDescriptor` used. `@Temporal` can also influence the `JdbcTypeDescriptor` used.
An `AttributeConverter` can also influence the `SqlTypeDescriptor` to use by the Java type it reports for its An `AttributeConverter` can also influence the `JdbcTypeDescriptor` to use by the Java type it reports for its
"relational type" "relational type"

View File

@ -9,7 +9,7 @@ package org.hibernate.userguide.collections.type;
import java.util.List; import java.util.List;
import org.hibernate.type.AbstractSingleColumnStandardBasicType; import org.hibernate.type.AbstractSingleColumnStandardBasicType;
import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor; import org.hibernate.type.descriptor.jdbc.VarcharTypeDescriptor;
/** /**
* @author Vlad Mihalcea * @author Vlad Mihalcea

View File

@ -11,14 +11,12 @@ import java.util.Comparator;
import java.util.Date; import java.util.Date;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.type.AbstractSingleColumnStandardBasicType; import org.hibernate.type.AbstractSingleColumnStandardBasicType;
import org.hibernate.type.LiteralType; import org.hibernate.type.LiteralType;
import org.hibernate.type.StringType;
import org.hibernate.type.VersionType; import org.hibernate.type.VersionType;
import org.hibernate.type.descriptor.java.JdbcTimestampTypeDescriptor; import org.hibernate.type.descriptor.java.JdbcTimestampTypeDescriptor;
import org.hibernate.type.descriptor.sql.BigIntTypeDescriptor; import org.hibernate.type.descriptor.jdbc.BigIntTypeDescriptor;
/** /**
* @author Vlad Mihalcea * @author Vlad Mihalcea

View File

@ -5,7 +5,7 @@ import java.util.BitSet;
import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Dialect;
import org.hibernate.type.AbstractSingleColumnStandardBasicType; import org.hibernate.type.AbstractSingleColumnStandardBasicType;
import org.hibernate.type.DiscriminatorType; import org.hibernate.type.DiscriminatorType;
import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor; import org.hibernate.type.descriptor.jdbc.VarcharTypeDescriptor;
/** /**
* @author Vlad Mihalcea * @author Vlad Mihalcea

View File

@ -1,7 +1,7 @@
package org.hibernate.userguide.mapping.basic; package org.hibernate.userguide.mapping.basic;
import org.hibernate.type.AbstractSingleColumnStandardBasicType; import org.hibernate.type.AbstractSingleColumnStandardBasicType;
import org.hibernate.type.descriptor.sql.CharTypeDescriptor; import org.hibernate.type.descriptor.jdbc.CharTypeDescriptor;
/** /**
* @author Vlad Mihalcea * @author Vlad Mihalcea

View File

@ -26,7 +26,7 @@ log4j.logger.org.hibernate.SQL=debug
### log JDBC bind parameters ### ### log JDBC bind parameters ###
log4j.logger.org.hibernate.type=trace log4j.logger.org.hibernate.type=trace
log4j.logger.org.hibernate.type.descriptor.sql=trace log4j.logger.org.hibernate.type.descriptor.jdbc=trace
log4j.logger.org.hibernate.id.enhanced.TableGenerator=trace log4j.logger.org.hibernate.id.enhanced.TableGenerator=trace
log4j.logger.org.hibernate.id.IdentifierGeneratorHelper=trace log4j.logger.org.hibernate.id.IdentifierGeneratorHelper=trace
log4j.logger.org.hibernate.persister.entity.AbstractEntityPersister=trace log4j.logger.org.hibernate.persister.entity.AbstractEntityPersister=trace

View File

@ -34,8 +34,8 @@ log4j.logger.org.hibernate.testing.cache=debug
# SQL Logging - HHH-6833 # SQL Logging - HHH-6833
log4j.logger.org.hibernate.SQL=debug log4j.logger.org.hibernate.SQL=debug
log4j.logger.org.hibernate.type.descriptor.sql.BasicBinder=trace log4j.logger.org.hibernate.type.descriptor.jdbc.BasicBinder=trace
log4j.logger.org.hibernate.type.descriptor.sql.BasicExtractor=trace log4j.logger.org.hibernate.type.descriptor.jdbc.BasicExtractor=trace
log4j.logger.org.hibernate.hql.internal.ast=debug log4j.logger.org.hibernate.hql.internal.ast=debug

View File

@ -10,8 +10,8 @@ import java.lang.annotation.Inherited;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import org.hibernate.resource.beans.spi.ManagedBean; import org.hibernate.resource.beans.spi.ManagedBean;
import org.hibernate.resource.beans.spi.ManagedBeanRegistry; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.FIELD;
@ -19,26 +19,25 @@ import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME; import static java.lang.annotation.RetentionPolicy.RUNTIME;
/** /**
* Allows specifying the specific {@link org.hibernate.type.descriptor.sql.SqlTypeDescriptor} * Allows specifying the specific {@link JdbcTypeDescriptor}
* to use for a particular column mapping. Can reference a {@link ManagedBean} - see * to use for a particular column mapping. Resolved as a {@link ManagedBean}
* {@link ManagedBeanRegistry}
* *
* ```` * ````
* @Entity * @Entity
* class User { * class User {
* ... * ...
* @SqlType ( MyCustomSqlIntegerDescriptor.class ) * @JdbcType ( MyCustomSqlIntegerDescriptor.class )
* int getAge() { ... } * int getAge() { ... }
* *
* @SqlType ( MyCustomSqlVarcharDescriptor.class ) * @JdbcType ( MyCustomSqlVarcharDescriptor.class )
* String getName() { ... } * String getName() { ... }
* } * }
* ```` * ````
* *
* @apiNote Should not be used in combination with {@link SqlTypeCode} * @apiNote Should not be used in combination with {@link JdbcTypeCode}
* *
* @see org.hibernate.type.descriptor.sql.SqlTypeDescriptor * @see JdbcTypeDescriptor
* @see org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry * @see JdbcTypeDescriptorRegistry
* *
* @author Steve Ebersole * @author Steve Ebersole
* *
@ -47,6 +46,6 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
@java.lang.annotation.Target({METHOD, FIELD, ANNOTATION_TYPE}) @java.lang.annotation.Target({METHOD, FIELD, ANNOTATION_TYPE})
@Inherited @Inherited
@Retention(RUNTIME) @Retention(RUNTIME)
public @interface SqlType { public @interface JdbcType {
Class<? extends SqlTypeDescriptor> value(); Class<? extends JdbcTypeDescriptor> value();
} }

View File

@ -9,6 +9,9 @@ package org.hibernate.annotations;
import java.lang.annotation.Inherited; import java.lang.annotation.Inherited;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.METHOD;
@ -17,10 +20,10 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
/** /**
* @asciidoc * @asciidoc
* *
* Allows specifying the {@link org.hibernate.type.descriptor.sql.SqlTypeDescriptor} to * Allows specifying the {@link JdbcTypeDescriptor} to
* use based on the type-code. This might be a* standard {@linkplain java.sql.Types JDBC Types} * use based on the type-code. This might be a standard {@linkplain java.sql.Types JDBC Type}
* code or a custom code. Either way, there must be an entry in the * code or a custom code. Either way, there must be an entry in the
* {@link org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry} registered under this code * {@link JdbcTypeDescriptorRegistry} registered under this code
* *
* ```` * ````
* @Entity * @Entity
@ -28,29 +31,29 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* ... * ...
* // By default Hibernate maps Java's Integer to JDBC's INTEGER * // By default Hibernate maps Java's Integer to JDBC's INTEGER
* // but here we want to use JDBC's TINYINT instead. * // but here we want to use JDBC's TINYINT instead.
* @SqlTypeCode ( Types.TINYINT ) * @JdbcTypeCode ( Types.TINYINT )
* int getAge() { ... } * int getAge() { ... }
* *
* // By default Hibernate maps Java's String to JDBC's VARCHAR * // By default Hibernate maps Java's String to JDBC's VARCHAR
* // but here we want to use JDBC's NVARCHAR instead. * // but here we want to use JDBC's NVARCHAR instead.
* @SqlTypeCode ( Types.NVARCHAR ) * @JdbcTypeCode ( Types.NVARCHAR )
* String getName() { ... } * String getName() { ... }
* } * }
* ```` * ````
* * *
* Other forms of influencing the JDBC type used include:<ul> * Other forms of influencing the JDBC type used include:<ul>
* <li>{@link javax.persistence.Enumerated} / {@link javax.persistence.EnumType}</li> * <li>{@link javax.persistence.Enumerated} / {@link javax.persistence.EnumType}</li>
* <li>{@link javax.persistence.TemporalType}</li> * <li>{@link javax.persistence.TemporalType}</li>
* <li>{@link javax.persistence.Lob}</li> * <li>{@link javax.persistence.Lob}</li>
* <li>{@link Nationalized}</li> * <li>{@link Nationalized}</li>
* <li>{@link SqlType}</li> * <li>{@link JdbcType}</li>
* </ul> * </ul>
* *
* These forms should not be mixed on the same mapping. The result is not defined * These forms should not be mixed on the same mapping. The result is not defined
* *
* @apiNote Should not be used in combination with {@link SqlType} * @apiNote Should not be used in combination with the other forms of influencing the JDBC type used
* *
* @see SqlTypeRegistration * @see JdbcTypeRegistration
* *
* @author Steve Ebersole * @author Steve Ebersole
* *
@ -59,10 +62,10 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
@java.lang.annotation.Target({METHOD, FIELD, ANNOTATION_TYPE}) @java.lang.annotation.Target({METHOD, FIELD, ANNOTATION_TYPE})
@Inherited @Inherited
@Retention(RUNTIME) @Retention(RUNTIME)
public @interface SqlTypeCode { public @interface JdbcTypeCode {
/** /**
* The standard {@linkplain java.sql.Types JDBC Types} code or a custom code. * The standard {@linkplain java.sql.Types JDBC Types} code or a custom code.
* This ultimately decides which {@link org.hibernate.type.descriptor.sql.SqlTypeDescriptor} * This ultimately decides which {@link JdbcTypeDescriptor}
* is used to "understand" the described SQL data type * is used to "understand" the described SQL data type
*/ */
int value(); int value();

View File

@ -10,7 +10,8 @@ import java.lang.annotation.Inherited;
import java.lang.annotation.Repeatable; import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.PACKAGE; import static java.lang.annotation.ElementType.PACKAGE;
@ -19,7 +20,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
/** /**
* Describes a SqlTypeDescriptor to be added to the * Describes a SqlTypeDescriptor to be added to the
* {@link org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry} * {@link JdbcTypeDescriptorRegistry}
* *
* @author Steve Ebersole * @author Steve Ebersole
* *
@ -28,18 +29,18 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
@java.lang.annotation.Target({PACKAGE, TYPE, ANNOTATION_TYPE}) @java.lang.annotation.Target({PACKAGE, TYPE, ANNOTATION_TYPE})
@Inherited @Inherited
@Retention(RUNTIME) @Retention(RUNTIME)
@Repeatable( SqlTypeRegistrations.class ) @Repeatable( JdbcTypeRegistrations.class )
public @interface SqlTypeRegistration { public @interface JdbcTypeRegistration {
/** /**
* The descriptor to register * The descriptor to register
*/ */
Class<? extends SqlTypeDescriptor> value(); Class<? extends JdbcTypeDescriptor> value();
/** /**
* The type-code under which to register this descriptor. Can either add a new descriptor * The type-code under which to register this descriptor. Can either add a new descriptor
* or override an existing one. * or override an existing one.
* *
* By default we will use {@link SqlTypeDescriptor#getJdbcTypeCode} * By default we will use {@link JdbcTypeDescriptor#getJdbcTypeCode}
*/ */
int registrationCode() default Integer.MIN_VALUE; int registrationCode() default Integer.MIN_VALUE;
} }

View File

@ -15,7 +15,7 @@ import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME; import static java.lang.annotation.RetentionPolicy.RUNTIME;
/** /**
* Grouping of {@link SqlTypeRegistration} * Grouping of {@link JdbcTypeRegistration}
* *
* @author Steve Ebersole * @author Steve Ebersole
* *
@ -24,6 +24,6 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
@java.lang.annotation.Target({PACKAGE, TYPE, ANNOTATION_TYPE}) @java.lang.annotation.Target({PACKAGE, TYPE, ANNOTATION_TYPE})
@Inherited @Inherited
@Retention(RUNTIME) @Retention(RUNTIME)
public @interface SqlTypeRegistrations { public @interface JdbcTypeRegistrations {
SqlTypeRegistration[] value(); JdbcTypeRegistration[] value();
} }

View File

@ -15,7 +15,7 @@ import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME; import static java.lang.annotation.RetentionPolicy.RUNTIME;
/** /**
* Same function as {@link SqlType}, but used to define the SQL type descriptor to * Same function as {@link JdbcType}, but used to define the SQL type descriptor to
* use for the map-key * use for the map-key
* *
* @author Steve Ebersole * @author Steve Ebersole
@ -25,6 +25,6 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
@java.lang.annotation.Target({METHOD, FIELD, ANNOTATION_TYPE}) @java.lang.annotation.Target({METHOD, FIELD, ANNOTATION_TYPE})
@Inherited @Inherited
@Retention(RUNTIME) @Retention(RUNTIME)
public @interface MapKeySqlType { public @interface MapKeyJdbcType {
SqlType value(); JdbcType value();
} }

View File

@ -15,7 +15,7 @@ import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME; import static java.lang.annotation.RetentionPolicy.RUNTIME;
/** /**
* Same function as {@link SqlTypeCode}, but used to define the SQL type descriptor to * Same function as {@link JdbcTypeCode}, but used to define the SQL type descriptor to
* use for the map-key * use for the map-key
* *
* @author Steve Ebersole * @author Steve Ebersole
@ -25,6 +25,6 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
@java.lang.annotation.Target({METHOD, FIELD, ANNOTATION_TYPE}) @java.lang.annotation.Target({METHOD, FIELD, ANNOTATION_TYPE})
@Inherited @Inherited
@Retention(RUNTIME) @Retention(RUNTIME)
public @interface MapKeySqlTypeCode { public @interface MapKeyJdbcTypeCode {
SqlTypeCode value(); JdbcTypeCode value();
} }

View File

@ -107,7 +107,7 @@ import org.hibernate.mapping.UniqueKey;
import org.hibernate.query.named.NamedObjectRepository; import org.hibernate.query.named.NamedObjectRepository;
import org.hibernate.query.sqm.function.SqmFunctionDescriptor; import org.hibernate.query.sqm.function.SqmFunctionDescriptor;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
/** /**
@ -397,8 +397,8 @@ public class InFlightMetadataCollectorImpl implements InFlightMetadataCollector
} }
@Override @Override
public void addSqlTypeRegistration(int typeCode, SqlTypeDescriptor std) { public void addJdbcTypeRegistration(int typeCode, JdbcTypeDescriptor jdbcTypeDescriptor) {
getTypeConfiguration().getSqlTypeDescriptorRegistry().addDescriptor( typeCode, std ); getTypeConfiguration().getJdbcTypeDescriptorRegistry().addDescriptor( typeCode, jdbcTypeDescriptor );
} }
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -68,7 +68,7 @@ import org.hibernate.query.sqm.function.SqmFunctionDescriptor;
import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistry;
import org.hibernate.type.BasicType; import org.hibernate.type.BasicType;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
import org.hibernate.usertype.UserType; import org.hibernate.usertype.UserType;
@ -283,8 +283,8 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont
} }
@Override @Override
public void contributeSqlTypeDescriptor(SqlTypeDescriptor descriptor) { public void contributeJdbcTypeDescriptor(JdbcTypeDescriptor descriptor) {
this.bootstrapContext.getTypeConfiguration().getSqlTypeDescriptorRegistry().addDescriptor( descriptor ); this.bootstrapContext.getTypeConfiguration().getJdbcTypeDescriptorRegistry().addDescriptor( descriptor );
} }
@Override @Override

View File

@ -9,7 +9,7 @@ package org.hibernate.boot.model;
import org.hibernate.type.BasicType; import org.hibernate.type.BasicType;
import org.hibernate.type.StandardBasicTypeTemplate; import org.hibernate.type.StandardBasicTypeTemplate;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry; import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
import org.hibernate.usertype.UserType; import org.hibernate.usertype.UserType;
@ -32,17 +32,17 @@ public interface TypeContributions {
* Add the JavaTypeDescriptor to the {@link TypeConfiguration}'s * Add the JavaTypeDescriptor to the {@link TypeConfiguration}'s
* {@link JavaTypeDescriptorRegistry} * {@link JavaTypeDescriptorRegistry}
*/ */
void contributeSqlTypeDescriptor(SqlTypeDescriptor descriptor); void contributeJdbcTypeDescriptor(JdbcTypeDescriptor descriptor);
void contributeType(BasicType type); void contributeType(BasicType type);
/** /**
* @deprecated (since 5.3) Use {@link #contributeType(BasicType)} instead. Basic * @deprecated (since 5.3) Use {@link #contributeType(BasicType)} instead. Basic
* types will be defined and handled much differently in 6.0 based on a combination * types will be defined and handled much differently in 6.0 based on a combination
* of {@link JavaTypeDescriptor}, {@link SqlTypeDescriptor} and a concept of a "value * of {@link JavaTypeDescriptor}, {@link JdbcTypeDescriptor} and a concept of a "value
* converter" (a JPA AttributeConverter, an enum value resolver, etc). To get as * converter" (a JPA AttributeConverter, an enum value resolver, etc). To get as
* close as possible in 5.3 use existing {@link JavaTypeDescriptor} and * close as possible in 5.3 use existing {@link JavaTypeDescriptor} and
* {@link SqlTypeDescriptor} implementations (or write your own for custom types) * {@link JdbcTypeDescriptor} implementations (or write your own for custom types)
* and use {@link StandardBasicTypeTemplate} to combine those with * and use {@link StandardBasicTypeTemplate} to combine those with
* registration keys and call {@link #contributeType(BasicType)} instead * registration keys and call {@link #contributeType(BasicType)} instead
*/ */
@ -54,7 +54,7 @@ public interface TypeContributions {
* {@link UserType}, as currently defined, will be done very differently in 6.0. * {@link UserType}, as currently defined, will be done very differently in 6.0.
* In most cases a {@link UserType} can be simply replaced with proper * In most cases a {@link UserType} can be simply replaced with proper
* {@link JavaTypeDescriptor}. To get as close as possible to 6.0 in 5.3 use * {@link JavaTypeDescriptor}. To get as close as possible to 6.0 in 5.3 use
* existing {@link JavaTypeDescriptor} and {@link SqlTypeDescriptor} * existing {@link JavaTypeDescriptor} and {@link JdbcTypeDescriptor}
* implementations (or write your own for custom impls) and use * implementations (or write your own for custom impls) and use
* {@link StandardBasicTypeTemplate} to combine those with registration keys * {@link StandardBasicTypeTemplate} to combine those with registration keys
* and call {@link #contributeType(BasicType)} instead * and call {@link #contributeType(BasicType)} instead

View File

@ -31,7 +31,7 @@ import org.hibernate.type.Type;
import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan; import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.java.MutabilityPlan; import org.hibernate.type.descriptor.java.MutabilityPlan;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators; import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
import org.hibernate.type.spi.TypeConfigurationAware; import org.hibernate.type.spi.TypeConfigurationAware;
@ -102,7 +102,7 @@ public class TypeDefinition implements Serializable {
public BasicValue.Resolution<?> resolve( public BasicValue.Resolution<?> resolve(
Map localConfigParameters, Map localConfigParameters,
MutabilityPlan explicitMutabilityPlan, MutabilityPlan explicitMutabilityPlan,
MetadataBuildingContext context, MetadataBuildingContext context,
SqlTypeDescriptorIndicators indicators) { SqlTypeDescriptorIndicators indicators) {
if ( CollectionHelper.isEmpty( localConfigParameters ) ) { if ( CollectionHelper.isEmpty( localConfigParameters ) ) {
// we can use the re-usable resolution... // we can use the re-usable resolution...
@ -212,8 +212,8 @@ public class TypeDefinition implements Serializable {
} }
@Override @Override
public SqlTypeDescriptor getRelationalSqlTypeDescriptor() { public JdbcTypeDescriptor getJdbcTypeDescriptor() {
return resolvedBasicType.getSqlTypeDescriptor(); return resolvedBasicType.getJdbcTypeDescriptor();
} }
@Override @Override
@ -264,8 +264,8 @@ public class TypeDefinition implements Serializable {
} }
@Override @Override
public SqlTypeDescriptor getRelationalSqlTypeDescriptor() { public JdbcTypeDescriptor getJdbcTypeDescriptor() {
return resolved.getSqlTypeDescriptor(); return resolved.getJdbcTypeDescriptor();
} }
@Override @Override

View File

@ -14,7 +14,7 @@ import org.hibernate.type.CustomType;
import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan; import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.java.MutabilityPlan; import org.hibernate.type.descriptor.java.MutabilityPlan;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
/** /**
* @author Steve Ebersole * @author Steve Ebersole
@ -23,19 +23,19 @@ public class EnumeratedValueResolution<E extends Enum<E>> implements BasicValue.
private final CustomType enumTypeMapping; private final CustomType enumTypeMapping;
private final JavaTypeDescriptor<E> domainJtd; private final JavaTypeDescriptor<E> domainJtd;
private final JavaTypeDescriptor<?> jdbcJtd; private final JavaTypeDescriptor<?> jdbcJtd;
private final SqlTypeDescriptor std; private final JdbcTypeDescriptor jdbcTypeDescriptor;
private final EnumValueConverter<E,?> valueConverter; private final EnumValueConverter<E,?> valueConverter;
public EnumeratedValueResolution( public EnumeratedValueResolution(
CustomType enumTypeMapping, CustomType enumTypeMapping,
JavaTypeDescriptor<E> domainJtd, JavaTypeDescriptor<E> domainJtd,
JavaTypeDescriptor<?> jdbcJtd, JavaTypeDescriptor<?> jdbcJtd,
SqlTypeDescriptor std, JdbcTypeDescriptor jdbcTypeDescriptor,
EnumValueConverter<E, ?> valueConverter) { EnumValueConverter<E, ?> valueConverter) {
this.enumTypeMapping = enumTypeMapping; this.enumTypeMapping = enumTypeMapping;
this.domainJtd = domainJtd; this.domainJtd = domainJtd;
this.jdbcJtd = jdbcJtd; this.jdbcJtd = jdbcJtd;
this.std = std; this.jdbcTypeDescriptor = jdbcTypeDescriptor;
this.valueConverter = valueConverter; this.valueConverter = valueConverter;
} }
@ -60,8 +60,8 @@ public class EnumeratedValueResolution<E extends Enum<E>> implements BasicValue.
} }
@Override @Override
public SqlTypeDescriptor getRelationalSqlTypeDescriptor() { public JdbcTypeDescriptor getJdbcTypeDescriptor() {
return std; return jdbcTypeDescriptor;
} }
@Override @Override

View File

@ -12,7 +12,7 @@ import org.hibernate.metamodel.model.convert.spi.BasicValueConverter;
import org.hibernate.type.BasicType; import org.hibernate.type.BasicType;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.java.MutabilityPlan; import org.hibernate.type.descriptor.java.MutabilityPlan;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
/** /**
* @author Steve Ebersole * @author Steve Ebersole
@ -20,7 +20,7 @@ import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
public class InferredBasicValueResolution<J> implements BasicValue.Resolution<J> { public class InferredBasicValueResolution<J> implements BasicValue.Resolution<J> {
private JavaTypeDescriptor<J> domainJtd; private JavaTypeDescriptor<J> domainJtd;
private JavaTypeDescriptor<J> relationalJtd; private JavaTypeDescriptor<J> relationalJtd;
private SqlTypeDescriptor relationalStd; private JdbcTypeDescriptor jdbcTypeDescriptor;
private MutabilityPlan mutabilityPlan; private MutabilityPlan mutabilityPlan;
@ -33,7 +33,7 @@ public class InferredBasicValueResolution<J> implements BasicValue.Resolution<J>
JdbcMapping jdbcMapping, JdbcMapping jdbcMapping,
JavaTypeDescriptor<J> domainJtd, JavaTypeDescriptor<J> domainJtd,
JavaTypeDescriptor<J> relationalJtd, JavaTypeDescriptor<J> relationalJtd,
SqlTypeDescriptor relationalStd, JdbcTypeDescriptor jdbcTypeDescriptor,
BasicValueConverter valueConverter, BasicValueConverter valueConverter,
BasicType<J> legacyType, BasicType<J> legacyType,
MutabilityPlan mutabilityPlan) { MutabilityPlan mutabilityPlan) {
@ -41,7 +41,7 @@ public class InferredBasicValueResolution<J> implements BasicValue.Resolution<J>
this.legacyType = legacyType; this.legacyType = legacyType;
this.domainJtd = domainJtd; this.domainJtd = domainJtd;
this.relationalJtd = relationalJtd; this.relationalJtd = relationalJtd;
this.relationalStd = relationalStd; this.jdbcTypeDescriptor = jdbcTypeDescriptor;
this.valueConverter = valueConverter; this.valueConverter = valueConverter;
this.mutabilityPlan = mutabilityPlan == null ? domainJtd.getMutabilityPlan() : mutabilityPlan; this.mutabilityPlan = mutabilityPlan == null ? domainJtd.getMutabilityPlan() : mutabilityPlan;
} }
@ -67,8 +67,8 @@ public class InferredBasicValueResolution<J> implements BasicValue.Resolution<J>
} }
@Override @Override
public SqlTypeDescriptor getRelationalSqlTypeDescriptor() { public JdbcTypeDescriptor getJdbcTypeDescriptor() {
return relationalStd; return jdbcTypeDescriptor;
} }
@Override @Override

View File

@ -27,9 +27,9 @@ import org.hibernate.type.descriptor.java.EnumJavaTypeDescriptor;
import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan; import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.java.TemporalJavaTypeDescriptor; import org.hibernate.type.descriptor.java.TemporalJavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
import org.hibernate.type.descriptor.sql.TinyIntTypeDescriptor; import org.hibernate.type.descriptor.jdbc.TinyIntTypeDescriptor;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
/** /**
@ -42,9 +42,9 @@ public class InferredBasicValueResolver {
@SuppressWarnings({"unchecked", "rawtypes"}) @SuppressWarnings({"unchecked", "rawtypes"})
public static BasicValue.Resolution from( public static BasicValue.Resolution from(
Function<TypeConfiguration, BasicJavaDescriptor> explicitJavaTypeAccess, Function<TypeConfiguration, BasicJavaDescriptor> explicitJavaTypeAccess,
Function<TypeConfiguration, SqlTypeDescriptor> explicitSqlTypeAccess, Function<TypeConfiguration, JdbcTypeDescriptor> explicitSqlTypeAccess,
Supplier<JavaTypeDescriptor> reflectedJtdResolver, Supplier<JavaTypeDescriptor> reflectedJtdResolver,
SqlTypeDescriptorIndicators stdIndicators, JdbcTypeDescriptorIndicators stdIndicators,
Table table, Table table,
Selectable selectable, Selectable selectable,
String ownerName, String ownerName,
@ -52,7 +52,7 @@ public class InferredBasicValueResolver {
TypeConfiguration typeConfiguration) { TypeConfiguration typeConfiguration) {
final BasicJavaDescriptor explicitJavaType = explicitJavaTypeAccess != null ? explicitJavaTypeAccess.apply( typeConfiguration ) : null; final BasicJavaDescriptor explicitJavaType = explicitJavaTypeAccess != null ? explicitJavaTypeAccess.apply( typeConfiguration ) : null;
final SqlTypeDescriptor explicitSqlType = explicitSqlTypeAccess != null ? explicitSqlTypeAccess.apply( typeConfiguration ) : null; final JdbcTypeDescriptor explicitJdbcType = explicitSqlTypeAccess != null ? explicitSqlTypeAccess.apply( typeConfiguration ) : null;
final BasicJavaDescriptor reflectedJtd = (BasicJavaDescriptor) reflectedJtdResolver.get(); final BasicJavaDescriptor reflectedJtd = (BasicJavaDescriptor) reflectedJtdResolver.get();
@ -66,20 +66,20 @@ public class InferredBasicValueResolver {
if ( explicitJavaType != null ) { if ( explicitJavaType != null ) {
// we have an explicit @JavaType // we have an explicit @JavaType
if ( explicitSqlType != null ) { if ( explicitJdbcType != null ) {
// we also have an explicit @SqlType(Code) // we also have an explicit @SqlType(Code)
jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve( jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve(
explicitJavaType, explicitJavaType,
explicitSqlType explicitJdbcType
); );
} }
else { else {
// infer the STD // infer the STD
final SqlTypeDescriptor inferredStd = explicitJavaType.getJdbcRecommendedSqlType( stdIndicators ); final JdbcTypeDescriptor inferredJdbcType = explicitJavaType.getRecommendedJdbcType( stdIndicators );
jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve( jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve(
explicitJavaType, explicitJavaType,
inferredStd inferredJdbcType
); );
} }
@ -88,12 +88,12 @@ public class InferredBasicValueResolver {
else if ( reflectedJtd != null ) { else if ( reflectedJtd != null ) {
// we were able to determine the "reflected java-type" // we were able to determine the "reflected java-type"
if ( explicitSqlType != null ) { if ( explicitJdbcType != null ) {
// we also have an explicit @SqlType(Code) // we also have an explicit @SqlType(Code)
jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve( jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve(
reflectedJtd, reflectedJtd,
explicitSqlType explicitJdbcType
); );
legacyType = jdbcMapping; legacyType = jdbcMapping;
@ -109,13 +109,13 @@ public class InferredBasicValueResolver {
} }
} }
else { else {
if ( explicitSqlType != null ) { if ( explicitJdbcType != null ) {
// we have an explicit STD, but no JTD - infer JTD // we have an explicit STD, but no JTD - infer JTD
// - NOTE : yes its an odd case, but its easy to implement here, so... // - NOTE : yes its an odd case, but its easy to implement here, so...
final BasicJavaDescriptor recommendedJtd = explicitSqlType.getJdbcRecommendedJavaTypeMapping( typeConfiguration ); final BasicJavaDescriptor recommendedJtd = explicitJdbcType.getJdbcRecommendedJavaTypeMapping( typeConfiguration );
final BasicType<?> resolved = typeConfiguration.getBasicTypeRegistry().resolve( final BasicType<?> resolved = typeConfiguration.getBasicTypeRegistry().resolve(
recommendedJtd, recommendedJtd,
explicitSqlType explicitJdbcType
); );
jdbcMapping = resolveSqlTypeIndicators( stdIndicators, resolved ); jdbcMapping = resolveSqlTypeIndicators( stdIndicators, resolved );
@ -148,7 +148,7 @@ public class InferredBasicValueResolver {
jdbcMapping, jdbcMapping,
jdbcMapping.getJavaTypeDescriptor(), jdbcMapping.getJavaTypeDescriptor(),
jdbcMapping.getJavaTypeDescriptor(), jdbcMapping.getJavaTypeDescriptor(),
jdbcMapping.getSqlTypeDescriptor(), jdbcMapping.getJdbcTypeDescriptor(),
null, null,
legacyType, legacyType,
null null
@ -157,7 +157,7 @@ public class InferredBasicValueResolver {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public static BasicType<?> resolveSqlTypeIndicators( public static BasicType<?> resolveSqlTypeIndicators(
SqlTypeDescriptorIndicators stdIndicators, JdbcTypeDescriptorIndicators stdIndicators,
BasicType<?> resolved) { BasicType<?> resolved) {
if ( resolved instanceof SqlTypeDescriptorIndicatorCapable ) { if ( resolved instanceof SqlTypeDescriptorIndicatorCapable ) {
final SqlTypeDescriptorIndicatorCapable indicatorCapable = (SqlTypeDescriptorIndicatorCapable) resolved; final SqlTypeDescriptorIndicatorCapable indicatorCapable = (SqlTypeDescriptorIndicatorCapable) resolved;
@ -173,8 +173,8 @@ public class InferredBasicValueResolver {
public static InferredBasicValueResolution fromEnum( public static InferredBasicValueResolution fromEnum(
EnumJavaTypeDescriptor enumJavaDescriptor, EnumJavaTypeDescriptor enumJavaDescriptor,
BasicJavaDescriptor explicitJavaType, BasicJavaDescriptor explicitJavaType,
SqlTypeDescriptor explicitSqlType, JdbcTypeDescriptor explicitJdbcType,
SqlTypeDescriptorIndicators stdIndicators, JdbcTypeDescriptorIndicators stdIndicators,
TypeConfiguration typeConfiguration) { TypeConfiguration typeConfiguration) {
final EnumType enumStyle = stdIndicators.getEnumeratedType() != null final EnumType enumStyle = stdIndicators.getEnumeratedType() != null
? stdIndicators.getEnumeratedType() ? stdIndicators.getEnumeratedType()
@ -199,12 +199,12 @@ public class InferredBasicValueResolver {
relationalJtd = typeConfiguration.getJavaTypeDescriptorRegistry().getDescriptor( relationalJavaType ); relationalJtd = typeConfiguration.getJavaTypeDescriptorRegistry().getDescriptor( relationalJavaType );
} }
final SqlTypeDescriptor std = explicitSqlType != null ? explicitSqlType : relationalJtd.getJdbcRecommendedSqlType( stdIndicators ); final JdbcTypeDescriptor jdbcTypeDescriptor = explicitJdbcType != null ? explicitJdbcType : relationalJtd.getRecommendedJdbcType( stdIndicators );
//noinspection unchecked //noinspection unchecked
final NamedEnumValueConverter valueConverter = new NamedEnumValueConverter( final NamedEnumValueConverter valueConverter = new NamedEnumValueConverter(
enumJavaDescriptor, enumJavaDescriptor,
std, jdbcTypeDescriptor,
relationalJtd relationalJtd
); );
@ -217,14 +217,14 @@ public class InferredBasicValueResolver {
final CustomType legacyEnumTypeWrapper = new CustomType( legacyEnumType, typeConfiguration ); final CustomType legacyEnumTypeWrapper = new CustomType( legacyEnumType, typeConfiguration );
final JdbcMapping jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve( relationalJtd, std ); final JdbcMapping jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve( relationalJtd, jdbcTypeDescriptor );
//noinspection unchecked //noinspection unchecked
return new InferredBasicValueResolution( return new InferredBasicValueResolution(
jdbcMapping, jdbcMapping,
enumJavaDescriptor, enumJavaDescriptor,
relationalJtd, relationalJtd,
std, jdbcTypeDescriptor,
valueConverter, valueConverter,
legacyEnumTypeWrapper, legacyEnumTypeWrapper,
ImmutableMutabilityPlan.INSTANCE ImmutableMutabilityPlan.INSTANCE
@ -247,12 +247,12 @@ public class InferredBasicValueResolver {
relationalJtd = typeConfiguration.getJavaTypeDescriptorRegistry().getDescriptor( Integer.class ); relationalJtd = typeConfiguration.getJavaTypeDescriptorRegistry().getDescriptor( Integer.class );
} }
final SqlTypeDescriptor std = explicitSqlType != null ? explicitSqlType : TinyIntTypeDescriptor.INSTANCE; final JdbcTypeDescriptor jdbcTypeDescriptor = explicitJdbcType != null ? explicitJdbcType : TinyIntTypeDescriptor.INSTANCE;
//noinspection unchecked //noinspection unchecked
final OrdinalEnumValueConverter valueConverter = new OrdinalEnumValueConverter( final OrdinalEnumValueConverter valueConverter = new OrdinalEnumValueConverter(
enumJavaDescriptor, enumJavaDescriptor,
std, jdbcTypeDescriptor,
relationalJtd relationalJtd
); );
@ -265,14 +265,14 @@ public class InferredBasicValueResolver {
final CustomType legacyEnumTypeWrapper = new CustomType( legacyEnumType, typeConfiguration ); final CustomType legacyEnumTypeWrapper = new CustomType( legacyEnumType, typeConfiguration );
final JdbcMapping jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve( relationalJtd, std ); final JdbcMapping jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve( relationalJtd, jdbcTypeDescriptor );
//noinspection unchecked //noinspection unchecked
return new InferredBasicValueResolution( return new InferredBasicValueResolution(
jdbcMapping, jdbcMapping,
enumJavaDescriptor, enumJavaDescriptor,
relationalJtd, relationalJtd,
std, jdbcTypeDescriptor,
valueConverter, valueConverter,
legacyEnumTypeWrapper, legacyEnumTypeWrapper,
ImmutableMutabilityPlan.INSTANCE ImmutableMutabilityPlan.INSTANCE
@ -288,8 +288,8 @@ public class InferredBasicValueResolver {
public static InferredBasicValueResolution fromTemporal( public static InferredBasicValueResolution fromTemporal(
TemporalJavaTypeDescriptor reflectedJtd, TemporalJavaTypeDescriptor reflectedJtd,
Function<TypeConfiguration, BasicJavaDescriptor> explicitJavaTypeAccess, Function<TypeConfiguration, BasicJavaDescriptor> explicitJavaTypeAccess,
Function<TypeConfiguration, SqlTypeDescriptor> explicitSqlTypeAccess, Function<TypeConfiguration, JdbcTypeDescriptor> explicitSqlTypeAccess,
SqlTypeDescriptorIndicators stdIndicators, JdbcTypeDescriptorIndicators stdIndicators,
TypeConfiguration typeConfiguration) { TypeConfiguration typeConfiguration) {
final TemporalType requestedTemporalPrecision = stdIndicators.getTemporalPrecision(); final TemporalType requestedTemporalPrecision = stdIndicators.getTemporalPrecision();
@ -301,12 +301,12 @@ public class InferredBasicValueResolver {
explicitJavaType = null; explicitJavaType = null;
} }
final SqlTypeDescriptor explicitSqlType; final JdbcTypeDescriptor explicitJdbcType;
if ( explicitSqlTypeAccess != null ) { if ( explicitSqlTypeAccess != null ) {
explicitSqlType = explicitSqlTypeAccess.apply( typeConfiguration ); explicitJdbcType = explicitSqlTypeAccess.apply( typeConfiguration );
} }
else { else {
explicitSqlType = null; explicitJdbcType = null;
} }
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -330,15 +330,15 @@ public class InferredBasicValueResolver {
); );
} }
final SqlTypeDescriptor std = explicitSqlType != null ? explicitSqlType : explicitTemporalJtd.getJdbcRecommendedSqlType( stdIndicators ); final JdbcTypeDescriptor jdbcTypeDescriptor = explicitJdbcType != null ? explicitJdbcType : explicitTemporalJtd.getRecommendedJdbcType( stdIndicators );
final BasicType jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve( explicitTemporalJtd, std ); final BasicType jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve( explicitTemporalJtd, jdbcTypeDescriptor );
return new InferredBasicValueResolution( return new InferredBasicValueResolution(
jdbcMapping, jdbcMapping,
explicitTemporalJtd, explicitTemporalJtd,
explicitTemporalJtd, explicitTemporalJtd,
std, jdbcTypeDescriptor,
null, null,
jdbcMapping, jdbcMapping,
explicitJavaType.getMutabilityPlan() explicitJavaType.getMutabilityPlan()
@ -351,7 +351,7 @@ public class InferredBasicValueResolver {
// - still a special case because we want to perform the new resolution // - still a special case because we want to perform the new resolution
// due to the new annotations being used // due to the new annotations being used
if ( explicitSqlType != null ) { if ( explicitJdbcType != null ) {
final TemporalJavaTypeDescriptor jtd; final TemporalJavaTypeDescriptor jtd;
if ( requestedTemporalPrecision != null ) { if ( requestedTemporalPrecision != null ) {
@ -364,13 +364,13 @@ public class InferredBasicValueResolver {
jtd = reflectedJtd; jtd = reflectedJtd;
} }
final BasicType jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve( jtd, explicitSqlType ); final BasicType jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve( jtd, explicitJdbcType );
return new InferredBasicValueResolution( return new InferredBasicValueResolution(
jdbcMapping, jdbcMapping,
jtd, jtd,
jtd, jtd,
explicitSqlType, explicitJdbcType,
null, null,
jdbcMapping, jdbcMapping,
jtd.getMutabilityPlan() jtd.getMutabilityPlan()
@ -401,7 +401,7 @@ public class InferredBasicValueResolver {
basicType, basicType,
basicType.getJavaTypeDescriptor(), basicType.getJavaTypeDescriptor(),
basicType.getJavaTypeDescriptor(), basicType.getJavaTypeDescriptor(),
basicType.getSqlTypeDescriptor(), basicType.getJdbcTypeDescriptor(),
null, null,
basicType, basicType,
reflectedJtd.getMutabilityPlan() reflectedJtd.getMutabilityPlan()

View File

@ -13,10 +13,9 @@ import org.hibernate.mapping.BasicValue;
import org.hibernate.metamodel.mapping.JdbcMapping; import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.model.convert.spi.BasicValueConverter; import org.hibernate.metamodel.model.convert.spi.BasicValueConverter;
import org.hibernate.type.BasicType; import org.hibernate.type.BasicType;
import org.hibernate.type.Type;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.java.MutabilityPlan; import org.hibernate.type.descriptor.java.MutabilityPlan;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
/** /**
@ -76,8 +75,8 @@ public class NamedBasicTypeResolution<J> implements BasicValue.Resolution<J> {
} }
@Override @Override
public SqlTypeDescriptor getRelationalSqlTypeDescriptor() { public JdbcTypeDescriptor getJdbcTypeDescriptor() {
return basicType.getSqlTypeDescriptor(); return basicType.getJdbcTypeDescriptor();
} }
@Override @Override

View File

@ -6,8 +6,6 @@
*/ */
package org.hibernate.boot.model.process.internal; package org.hibernate.boot.model.process.internal;
import java.util.Collections;
import java.util.List;
import java.util.function.Function; import java.util.function.Function;
import javax.persistence.AttributeConverter; import javax.persistence.AttributeConverter;
@ -17,25 +15,18 @@ import org.hibernate.boot.model.convert.spi.JpaAttributeConverterCreationContext
import org.hibernate.boot.registry.StandardServiceRegistry; import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService; import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.boot.spi.MetadataBuildingContext; import org.hibernate.boot.spi.MetadataBuildingContext;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.mapping.BasicValue; import org.hibernate.mapping.BasicValue;
import org.hibernate.mapping.IndexedConsumer;
import org.hibernate.metamodel.mapping.JdbcMapping; import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.mapping.MappingModelExpressable;
import org.hibernate.metamodel.mapping.SqlExpressable;
import org.hibernate.metamodel.model.convert.spi.JpaAttributeConverter; import org.hibernate.metamodel.model.convert.spi.JpaAttributeConverter;
import org.hibernate.sql.ast.Clause;
import org.hibernate.type.BasicType; import org.hibernate.type.BasicType;
import org.hibernate.type.descriptor.ValueBinder;
import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.converter.AttributeConverterMutabilityPlanImpl; import org.hibernate.type.descriptor.converter.AttributeConverterMutabilityPlanImpl;
import org.hibernate.type.descriptor.converter.AttributeConverterTypeAdapter; import org.hibernate.type.descriptor.converter.AttributeConverterTypeAdapter;
import org.hibernate.type.descriptor.java.BasicJavaDescriptor; import org.hibernate.type.descriptor.java.BasicJavaDescriptor;
import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan; import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.java.MutabilityPlan; import org.hibernate.type.descriptor.java.MutabilityPlan;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
/** /**
@ -47,9 +38,9 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
public static NamedConverterResolution from( public static NamedConverterResolution from(
ConverterDescriptor converterDescriptor, ConverterDescriptor converterDescriptor,
Function<TypeConfiguration, BasicJavaDescriptor> explicitJtdAccess, Function<TypeConfiguration, BasicJavaDescriptor> explicitJtdAccess,
Function<TypeConfiguration, SqlTypeDescriptor> explicitStdAccess, Function<TypeConfiguration, JdbcTypeDescriptor> explicitStdAccess,
Function<TypeConfiguration, MutabilityPlan> explicitMutabilityPlanAccess, Function<TypeConfiguration, MutabilityPlan> explicitMutabilityPlanAccess,
SqlTypeDescriptorIndicators sqlTypeIndicators, JdbcTypeDescriptorIndicators sqlTypeIndicators,
JpaAttributeConverterCreationContext converterCreationContext, JpaAttributeConverterCreationContext converterCreationContext,
MetadataBuildingContext context) { MetadataBuildingContext context) {
return fromInternal( return fromInternal(
@ -65,9 +56,9 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
public static NamedConverterResolution from( public static NamedConverterResolution from(
String name, String name,
Function<TypeConfiguration, BasicJavaDescriptor> explicitJtdAccess, Function<TypeConfiguration, BasicJavaDescriptor> explicitJtdAccess,
Function<TypeConfiguration, SqlTypeDescriptor> explicitStdAccess, Function<TypeConfiguration, JdbcTypeDescriptor> explicitStdAccess,
Function<TypeConfiguration, MutabilityPlan> explicitMutabilityPlanAccess, Function<TypeConfiguration, MutabilityPlan> explicitMutabilityPlanAccess,
SqlTypeDescriptorIndicators sqlTypeIndicators, JdbcTypeDescriptorIndicators sqlTypeIndicators,
JpaAttributeConverterCreationContext converterCreationContext, JpaAttributeConverterCreationContext converterCreationContext,
MetadataBuildingContext context) { MetadataBuildingContext context) {
assert name.startsWith( ConverterDescriptor.TYPE_NAME_PREFIX ); assert name.startsWith( ConverterDescriptor.TYPE_NAME_PREFIX );
@ -94,9 +85,9 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
private static NamedConverterResolution fromInternal( private static NamedConverterResolution fromInternal(
Function<TypeConfiguration, BasicJavaDescriptor> explicitJtdAccess, Function<TypeConfiguration, BasicJavaDescriptor> explicitJtdAccess,
Function<TypeConfiguration, SqlTypeDescriptor> explicitStdAccess, Function<TypeConfiguration, JdbcTypeDescriptor> explicitStdAccess,
Function<TypeConfiguration, MutabilityPlan> explicitMutabilityPlanAccess, Function<TypeConfiguration, MutabilityPlan> explicitMutabilityPlanAccess,
JpaAttributeConverter converter, SqlTypeDescriptorIndicators sqlTypeIndicators, JpaAttributeConverter converter, JdbcTypeDescriptorIndicators sqlTypeIndicators,
MetadataBuildingContext context) { MetadataBuildingContext context) {
final TypeConfiguration typeConfiguration = context.getBootstrapContext().getTypeConfiguration(); final TypeConfiguration typeConfiguration = context.getBootstrapContext().getTypeConfiguration();
@ -108,15 +99,15 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
? explicitJtd ? explicitJtd
: converter.getDomainJavaDescriptor(); : converter.getDomainJavaDescriptor();
final SqlTypeDescriptor explicitStd = explicitStdAccess != null final JdbcTypeDescriptor explicitJdbcType = explicitStdAccess != null
? explicitStdAccess.apply( typeConfiguration ) ? explicitStdAccess.apply( typeConfiguration )
: null; : null;
final JavaTypeDescriptor relationalJtd = converter.getRelationalJavaDescriptor(); final JavaTypeDescriptor relationalJtd = converter.getRelationalJavaDescriptor();
final SqlTypeDescriptor relationalStd = explicitStd != null final JdbcTypeDescriptor jdbcType = explicitJdbcType != null
? explicitStd ? explicitJdbcType
: relationalJtd.getJdbcRecommendedSqlType( sqlTypeIndicators ); : relationalJtd.getRecommendedJdbcType( sqlTypeIndicators );
final MutabilityPlan explicitMutabilityPlan = explicitMutabilityPlanAccess != null final MutabilityPlan explicitMutabilityPlan = explicitMutabilityPlanAccess != null
? explicitMutabilityPlanAccess.apply( typeConfiguration ) ? explicitMutabilityPlanAccess.apply( typeConfiguration )
@ -137,7 +128,7 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
return new NamedConverterResolution( return new NamedConverterResolution(
domainJtd, domainJtd,
relationalJtd, relationalJtd,
relationalStd, jdbcType,
converter, converter,
mutabilityPlan, mutabilityPlan,
context.getBootstrapContext().getTypeConfiguration() context.getBootstrapContext().getTypeConfiguration()
@ -147,7 +138,7 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
private final JavaTypeDescriptor domainJtd; private final JavaTypeDescriptor domainJtd;
private final JavaTypeDescriptor relationalJtd; private final JavaTypeDescriptor relationalJtd;
private final SqlTypeDescriptor relationalStd; private final JdbcTypeDescriptor jdbcTypeDescriptor;
private final JpaAttributeConverter valueConverter; private final JpaAttributeConverter valueConverter;
private final MutabilityPlan mutabilityPlan; private final MutabilityPlan mutabilityPlan;
@ -160,7 +151,7 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
public NamedConverterResolution( public NamedConverterResolution(
JavaTypeDescriptor domainJtd, JavaTypeDescriptor domainJtd,
JavaTypeDescriptor relationalJtd, JavaTypeDescriptor relationalJtd,
SqlTypeDescriptor relationalStd, JdbcTypeDescriptor jdbcTypeDescriptor,
JpaAttributeConverter valueConverter, JpaAttributeConverter valueConverter,
MutabilityPlan mutabilityPlan, MutabilityPlan mutabilityPlan,
TypeConfiguration typeConfiguration) { TypeConfiguration typeConfiguration) {
@ -170,8 +161,8 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
assert relationalJtd != null; assert relationalJtd != null;
this.relationalJtd = relationalJtd; this.relationalJtd = relationalJtd;
assert relationalStd != null; assert jdbcTypeDescriptor != null;
this.relationalStd = relationalStd; this.jdbcTypeDescriptor = jdbcTypeDescriptor;
assert valueConverter != null; assert valueConverter != null;
this.valueConverter = valueConverter; this.valueConverter = valueConverter;
@ -181,7 +172,7 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
this.jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve( this.jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve(
relationalJtd, relationalJtd,
relationalStd jdbcTypeDescriptor
); );
// this.jdbcMapping = new JdbcMapping() { // this.jdbcMapping = new JdbcMapping() {
// private final ValueExtractor extractor = relationalStd.getExtractor( relationalJtd ); // private final ValueExtractor extractor = relationalStd.getExtractor( relationalJtd );
@ -225,7 +216,7 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
relationalJtd.getJavaType().getTypeName() relationalJtd.getJavaType().getTypeName()
), ),
valueConverter, valueConverter,
relationalStd, jdbcTypeDescriptor,
relationalJtd, relationalJtd,
domainJtd, domainJtd,
mutabilityPlan mutabilityPlan
@ -250,8 +241,8 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
} }
@Override @Override
public SqlTypeDescriptor getRelationalSqlTypeDescriptor() { public JdbcTypeDescriptor getJdbcTypeDescriptor() {
return relationalStd; return jdbcTypeDescriptor;
} }
@Override @Override
@ -275,140 +266,4 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
return "NamedConverterResolution(" + valueConverter.getConverterBean().getBeanClass().getName() + ')'; return "NamedConverterResolution(" + valueConverter.getConverterBean().getBeanClass().getName() + ')';
} }
/**
* Allows treating the attribute conversion as a jdbc-level reference.
* This covers the conversion plus managing the JDBC-value
*/
private static class ConverterJdbcMappingImpl implements JdbcMapping, MappingModelExpressable<Object>, SqlExpressable {
private final JavaTypeDescriptor domainJtd;
private final JavaTypeDescriptor jdbcJtd;
private final SqlTypeDescriptor std;
private final JpaAttributeConverter valueConverter;
private final MutabilityPlan mutabilityPlan;
private final ValueExtractor extractor;
private final ValueBinder binder;
private final BasicType lowLevelJdbcMapping;
public ConverterJdbcMappingImpl(
JavaTypeDescriptor domainJtd,
JavaTypeDescriptor jdbcJtd,
SqlTypeDescriptor std,
JpaAttributeConverter valueConverter,
MutabilityPlan mutabilityPlan,
TypeConfiguration typeConfiguration) {
this.domainJtd = domainJtd;
this.jdbcJtd = jdbcJtd;
this.std = std;
this.valueConverter = valueConverter;
this.mutabilityPlan = mutabilityPlan;
this.extractor = std.getExtractor( jdbcJtd );
this.binder = std.getBinder( jdbcJtd );
this.lowLevelJdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve( jdbcJtd, std );
}
@Override
public JavaTypeDescriptor getJavaTypeDescriptor() {
return domainJtd;
}
@Override
public SqlTypeDescriptor getSqlTypeDescriptor() {
return std;
}
@Override
public ValueExtractor getJdbcValueExtractor() {
return extractor;
}
@Override
public ValueBinder getJdbcValueBinder() {
return binder;
}
@Override
public int getJdbcTypeCount() {
return 1;
}
@Override
public List<JdbcMapping> getJdbcMappings() {
return Collections.singletonList( this );
}
@Override
public int forEachJdbcType(IndexedConsumer<JdbcMapping> action) {
action.accept( 0, this );
return 1;
}
@Override
public int forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action) {
action.accept( offset, this );
return 1;
}
@Override
public Object disassemble(Object value, SharedSessionContractImplementor session) {
return mutabilityPlan.disassemble( value );
}
@Override
public int forEachJdbcValue(
Object value,
Clause clause,
int offset,
JdbcValuesConsumer valuesConsumer,
SharedSessionContractImplementor session) {
final AttributeConverter converter = (AttributeConverter) valueConverter.getConverterBean().getBeanInstance();
final Object converted = converter.convertToDatabaseColumn( value );
valuesConsumer.consume( offset, converted, this );
return 1;
}
@Override
public int forEachDisassembledJdbcValue(
Object value,
Clause clause,
JdbcValuesConsumer valuesConsumer,
SharedSessionContractImplementor session) {
final AttributeConverter converter = (AttributeConverter) valueConverter.getConverterBean().getBeanInstance();
final Object converted = converter.convertToDatabaseColumn( value );
valuesConsumer.consume( 0, converted, this );
return 1;
}
@Override
public int forEachDisassembledJdbcValue(
Object value,
Clause clause,
int offset,
JdbcValuesConsumer valuesConsumer,
SharedSessionContractImplementor session) {
final AttributeConverter converter = (AttributeConverter) valueConverter.getConverterBean().getBeanInstance();
final Object converted = converter.convertToDatabaseColumn( value );
valuesConsumer.consume( offset, converted, this );
return 1;
}
@Override
public int forEachJdbcValue(
Object value,
Clause clause,
JdbcValuesConsumer valuesConsumer,
SharedSessionContractImplementor session) {
final AttributeConverter converter = (AttributeConverter) valueConverter.getConverterBean().getBeanInstance();
final Object converted = converter.convertToDatabaseColumn( value );
valuesConsumer.consume( 0, converted, this );
return 1;
}
@Override
public JdbcMapping getJdbcMapping() {
return lowLevelJdbcMapping;
}
}
} }

View File

@ -11,10 +11,9 @@ import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.model.convert.spi.BasicValueConverter; import org.hibernate.metamodel.model.convert.spi.BasicValueConverter;
import org.hibernate.type.BasicType; import org.hibernate.type.BasicType;
import org.hibernate.type.CustomType; import org.hibernate.type.CustomType;
import org.hibernate.type.Type;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.java.MutabilityPlan; import org.hibernate.type.descriptor.java.MutabilityPlan;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
/** /**
* @author Steve Ebersole * @author Steve Ebersole
@ -43,8 +42,8 @@ public class UserTypeResolution implements BasicValue.Resolution {
} }
@Override @Override
public SqlTypeDescriptor getRelationalSqlTypeDescriptor() { public JdbcTypeDescriptor getJdbcTypeDescriptor() {
return userTypeAdapter.getSqlTypeDescriptor(); return userTypeAdapter.getJdbcTypeDescriptor();
} }
@Override @Override

View File

@ -20,8 +20,8 @@ import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.java.MutabilityPlan; import org.hibernate.type.descriptor.java.MutabilityPlan;
import org.hibernate.type.descriptor.java.PrimitiveByteArrayTypeDescriptor; import org.hibernate.type.descriptor.java.PrimitiveByteArrayTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
/** /**
@ -37,7 +37,7 @@ public class VersionResolution<E> implements BasicValue.Resolution<E> {
public static <E> VersionResolution<E> from( public static <E> VersionResolution<E> from(
Function<TypeConfiguration, java.lang.reflect.Type> implicitJavaTypeAccess, Function<TypeConfiguration, java.lang.reflect.Type> implicitJavaTypeAccess,
Function<TypeConfiguration, BasicJavaDescriptor> explicitJtdAccess, Function<TypeConfiguration, BasicJavaDescriptor> explicitJtdAccess,
Function<TypeConfiguration, SqlTypeDescriptor> explicitStdAccess, Function<TypeConfiguration, JdbcTypeDescriptor> explicitStdAccess,
TypeConfiguration typeConfiguration, TypeConfiguration typeConfiguration,
@SuppressWarnings("unused") MetadataBuildingContext context) { @SuppressWarnings("unused") MetadataBuildingContext context) {
@ -49,7 +49,7 @@ public class VersionResolution<E> implements BasicValue.Resolution<E> {
if ( registered instanceof PrimitiveByteArrayTypeDescriptor ) { if ( registered instanceof PrimitiveByteArrayTypeDescriptor ) {
return new VersionResolution<>( return new VersionResolution<>(
RowVersionType.INSTANCE.getJavaTypeDescriptor(), RowVersionType.INSTANCE.getJavaTypeDescriptor(),
RowVersionType.INSTANCE.getSqlTypeDescriptor(), RowVersionType.INSTANCE.getJdbcTypeDescriptor(),
RowVersionType.INSTANCE, RowVersionType.INSTANCE,
RowVersionType.INSTANCE RowVersionType.INSTANCE
); );
@ -57,8 +57,8 @@ public class VersionResolution<E> implements BasicValue.Resolution<E> {
final BasicJavaDescriptor jtd = (BasicJavaDescriptor) registered; final BasicJavaDescriptor jtd = (BasicJavaDescriptor) registered;
final SqlTypeDescriptor std = jtd.getJdbcRecommendedSqlType( final JdbcTypeDescriptor recommendedJdbcType = jtd.getRecommendedJdbcType(
new SqlTypeDescriptorIndicators() { new JdbcTypeDescriptorIndicators() {
@Override @Override
public TypeConfiguration getTypeConfiguration() { public TypeConfiguration getTypeConfiguration() {
return typeConfiguration; return typeConfiguration;
@ -72,27 +72,27 @@ public class VersionResolution<E> implements BasicValue.Resolution<E> {
} }
); );
final BasicType<?> basicType = typeConfiguration.getBasicTypeRegistry().resolve( jtd, std ); final BasicType<?> basicType = typeConfiguration.getBasicTypeRegistry().resolve( jtd, recommendedJdbcType );
final BasicType legacyType = typeConfiguration.getBasicTypeRegistry().getRegisteredType( jtd.getJavaType() ); final BasicType legacyType = typeConfiguration.getBasicTypeRegistry().getRegisteredType( jtd.getJavaType() );
assert legacyType.getSqlTypeDescriptor().equals( std ); assert legacyType.getJdbcTypeDescriptor().equals( recommendedJdbcType );
return new VersionResolution<>( jtd, std, basicType, legacyType ); return new VersionResolution<>( jtd, recommendedJdbcType, basicType, legacyType );
} }
private final JavaTypeDescriptor jtd; private final JavaTypeDescriptor jtd;
private final SqlTypeDescriptor std; private final JdbcTypeDescriptor jdbcTypeDescriptor;
private final JdbcMapping jdbcMapping; private final JdbcMapping jdbcMapping;
private final BasicType legacyType; private final BasicType legacyType;
public VersionResolution( public VersionResolution(
JavaTypeDescriptor javaTypeDescriptor, JavaTypeDescriptor javaTypeDescriptor,
SqlTypeDescriptor sqlTypeDescriptor, JdbcTypeDescriptor jdbcTypeDescriptor,
JdbcMapping jdbcMapping, JdbcMapping jdbcMapping,
BasicType legacyType) { BasicType legacyType) {
this.jtd = javaTypeDescriptor; this.jtd = javaTypeDescriptor;
this.std = sqlTypeDescriptor; this.jdbcTypeDescriptor = jdbcTypeDescriptor;
this.jdbcMapping = jdbcMapping; this.jdbcMapping = jdbcMapping;
this.legacyType = legacyType; this.legacyType = legacyType;
} }
@ -120,8 +120,8 @@ public class VersionResolution<E> implements BasicValue.Resolution<E> {
} }
@Override @Override
public SqlTypeDescriptor getRelationalSqlTypeDescriptor() { public JdbcTypeDescriptor getJdbcTypeDescriptor() {
return std; return jdbcTypeDescriptor;
} }
@Override @Override

View File

@ -29,7 +29,6 @@ import org.hibernate.boot.model.source.spi.MetadataSourceProcessor;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService; import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.boot.spi.AdditionalJaxbMappingProducer; import org.hibernate.boot.spi.AdditionalJaxbMappingProducer;
import org.hibernate.boot.spi.BootstrapContext; import org.hibernate.boot.spi.BootstrapContext;
import org.hibernate.boot.spi.MetadataBuildingContext;
import org.hibernate.boot.spi.MetadataBuildingOptions; import org.hibernate.boot.spi.MetadataBuildingOptions;
import org.hibernate.boot.spi.MetadataContributor; import org.hibernate.boot.spi.MetadataContributor;
import org.hibernate.boot.spi.MetadataImplementor; import org.hibernate.boot.spi.MetadataImplementor;
@ -42,7 +41,7 @@ import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.type.BasicType; import org.hibernate.type.BasicType;
import org.hibernate.type.BasicTypeRegistry; import org.hibernate.type.BasicTypeRegistry;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
import org.hibernate.usertype.UserType; import org.hibernate.usertype.UserType;
@ -374,8 +373,8 @@ public class MetadataBuildingProcess {
} }
@Override @Override
public void contributeSqlTypeDescriptor(SqlTypeDescriptor descriptor) { public void contributeJdbcTypeDescriptor(JdbcTypeDescriptor descriptor) {
bootstrapContext.getTypeConfiguration().getSqlTypeDescriptorRegistry().addDescriptor( descriptor ); bootstrapContext.getTypeConfiguration().getJdbcTypeDescriptorRegistry().addDescriptor( descriptor );
} }
@Override @Override

View File

@ -1983,7 +1983,7 @@ public class ModelBinder {
.getBasicTypeRegistry() .getBasicTypeRegistry()
.getRegisteredType( value.getTypeName() ); .getRegisteredType( value.getTypeName() );
if ( basicType instanceof AbstractSingleColumnStandardBasicType ) { if ( basicType instanceof AbstractSingleColumnStandardBasicType ) {
if ( isLob( basicType.getSqlTypeDescriptor().getSqlType(), null ) ) { if ( isLob( basicType.getJdbcTypeDescriptor().getJdbcType(), null ) ) {
value.makeLob(); value.makeLob();
} }
} }
@ -2004,9 +2004,9 @@ public class ModelBinder {
private static boolean isLob(Integer sqlType, String sqlTypeName) { private static boolean isLob(Integer sqlType, String sqlTypeName) {
if ( sqlType != null ) { if ( sqlType != null ) {
return ClobType.INSTANCE.getSqlTypeDescriptor().getSqlType() == sqlType || return ClobType.INSTANCE.getJdbcTypeDescriptor().getJdbcType() == sqlType ||
BlobType.INSTANCE.getSqlTypeDescriptor().getSqlType() == sqlType || BlobType.INSTANCE.getJdbcTypeDescriptor().getJdbcType() == sqlType ||
NClobType.INSTANCE.getSqlTypeDescriptor().getSqlType() == sqlType; NClobType.INSTANCE.getJdbcTypeDescriptor().getJdbcType() == sqlType;
} }
else if ( sqlTypeName != null ) { else if ( sqlTypeName != null ) {
return ClobType.INSTANCE.getName().equalsIgnoreCase( sqlTypeName ) || return ClobType.INSTANCE.getName().equalsIgnoreCase( sqlTypeName ) ||

View File

@ -52,7 +52,7 @@ import org.hibernate.mapping.MappedSuperclass;
import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Table; import org.hibernate.mapping.Table;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
/** /**
* An in-flight representation of Metadata while Metadata is being built. * An in-flight representation of Metadata while Metadata is being built.
@ -320,7 +320,7 @@ public interface InFlightMetadataCollector extends Mapping, MetadataImplementor
void registerValueMappingResolver(Function<MetadataBuildingContext,Boolean> resolver); void registerValueMappingResolver(Function<MetadataBuildingContext,Boolean> resolver);
void addJavaTypeRegistration(Class<?> javaType, JavaTypeDescriptor<?> jtd); void addJavaTypeRegistration(Class<?> javaType, JavaTypeDescriptor<?> jtd);
void addSqlTypeRegistration(int typeCode, SqlTypeDescriptor std); void addJdbcTypeRegistration(int typeCode, JdbcTypeDescriptor jdbcTypeDescriptor);
interface DelayedPropertyReferenceHandler extends Serializable { interface DelayedPropertyReferenceHandler extends Serializable {
void process(InFlightMetadataCollector metadataCollector); void process(InFlightMetadataCollector metadataCollector);

View File

@ -8,7 +8,6 @@ package org.hibernate.cfg;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.HashMap; import java.util.HashMap;
@ -119,8 +118,8 @@ import org.hibernate.annotations.Proxy;
import org.hibernate.annotations.SortComparator; import org.hibernate.annotations.SortComparator;
import org.hibernate.annotations.SortNatural; import org.hibernate.annotations.SortNatural;
import org.hibernate.annotations.Source; import org.hibernate.annotations.Source;
import org.hibernate.annotations.SqlTypeRegistration; import org.hibernate.annotations.JdbcTypeRegistration;
import org.hibernate.annotations.SqlTypeRegistrations; import org.hibernate.annotations.JdbcTypeRegistrations;
import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs; import org.hibernate.annotations.TypeDefs;
import org.hibernate.annotations.Where; import org.hibernate.annotations.Where;
@ -171,7 +170,7 @@ import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.UnionSubclass; import org.hibernate.mapping.UnionSubclass;
import org.hibernate.resource.beans.spi.ManagedBeanRegistry; import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
import org.hibernate.type.descriptor.java.BasicJavaDescriptor; import org.hibernate.type.descriptor.java.BasicJavaDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import static org.hibernate.internal.CoreLogging.messageLogger; import static org.hibernate.internal.CoreLogging.messageLogger;
@ -357,14 +356,14 @@ public final class AnnotationBinder {
private static void handleSqlTypeDescriptorRegistration( private static void handleSqlTypeDescriptorRegistration(
MetadataBuildingContext context, MetadataBuildingContext context,
ManagedBeanRegistry managedBeanRegistry, ManagedBeanRegistry managedBeanRegistry,
SqlTypeRegistration annotation) { JdbcTypeRegistration annotation) {
final Class<? extends SqlTypeDescriptor> stdClass = annotation.value(); final Class<? extends JdbcTypeDescriptor> jdbcTypeClass = annotation.value();
final SqlTypeDescriptor std = managedBeanRegistry.getBean( stdClass ).getBeanInstance(); final JdbcTypeDescriptor jdbcTypeDescriptor = managedBeanRegistry.getBean( jdbcTypeClass ).getBeanInstance();
final int typeCode = annotation.registrationCode() == Integer.MIN_VALUE final int typeCode = annotation.registrationCode() == Integer.MIN_VALUE
? std.getJdbcTypeCode() ? jdbcTypeDescriptor.getJdbcTypeCode()
: annotation.registrationCode(); : annotation.registrationCode();
context.getMetadataCollector().addSqlTypeRegistration( typeCode, std ); context.getMetadataCollector().addJdbcTypeRegistration( typeCode, jdbcTypeDescriptor );
} }
private static void handleJavaTypeDescriptorRegistration( private static void handleJavaTypeDescriptorRegistration(
@ -883,13 +882,13 @@ public final class AnnotationBinder {
} }
} }
if ( annotatedElement.isAnnotationPresent( SqlTypeRegistration.class ) ) { if ( annotatedElement.isAnnotationPresent( JdbcTypeRegistration.class ) ) {
final SqlTypeRegistration annotation = annotatedElement.getAnnotation( SqlTypeRegistration.class ); final JdbcTypeRegistration annotation = annotatedElement.getAnnotation( JdbcTypeRegistration.class );
handleSqlTypeDescriptorRegistration( context, managedBeanRegistry, annotation ); handleSqlTypeDescriptorRegistration( context, managedBeanRegistry, annotation );
} }
if ( annotatedElement.isAnnotationPresent( SqlTypeRegistrations.class ) ) { if ( annotatedElement.isAnnotationPresent( JdbcTypeRegistrations.class ) ) {
final SqlTypeRegistrations annotation = annotatedElement.getAnnotation( SqlTypeRegistrations.class ); final JdbcTypeRegistrations annotation = annotatedElement.getAnnotation( JdbcTypeRegistrations.class );
final SqlTypeRegistration[] registrations = annotation.value(); final JdbcTypeRegistration[] registrations = annotation.value();
for ( int i = 0; i < registrations.length; i++ ) { for ( int i = 0; i < registrations.length; i++ ) {
handleSqlTypeDescriptorRegistration( context, managedBeanRegistry, registrations[i] ); handleSqlTypeDescriptorRegistration( context, managedBeanRegistry, registrations[i] );
} }

View File

@ -27,14 +27,14 @@ import org.hibernate.annotations.CollectionId;
import org.hibernate.annotations.Immutable; import org.hibernate.annotations.Immutable;
import org.hibernate.annotations.JavaType; import org.hibernate.annotations.JavaType;
import org.hibernate.annotations.MapKeyJavaType; import org.hibernate.annotations.MapKeyJavaType;
import org.hibernate.annotations.MapKeySqlType; import org.hibernate.annotations.MapKeyJdbcType;
import org.hibernate.annotations.MapKeySqlTypeCode; import org.hibernate.annotations.MapKeyJdbcTypeCode;
import org.hibernate.annotations.MapKeyType; import org.hibernate.annotations.MapKeyType;
import org.hibernate.annotations.Mutability; import org.hibernate.annotations.Mutability;
import org.hibernate.annotations.Nationalized; import org.hibernate.annotations.Nationalized;
import org.hibernate.annotations.Parameter; import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.SqlType; import org.hibernate.annotations.JdbcType;
import org.hibernate.annotations.SqlTypeCode; import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.annotations.Type; import org.hibernate.annotations.Type;
import org.hibernate.annotations.common.reflection.XClass; import org.hibernate.annotations.common.reflection.XClass;
import org.hibernate.annotations.common.reflection.XProperty; import org.hibernate.annotations.common.reflection.XProperty;
@ -57,8 +57,8 @@ import org.hibernate.mapping.Table;
import org.hibernate.type.descriptor.java.BasicJavaDescriptor; import org.hibernate.type.descriptor.java.BasicJavaDescriptor;
import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan; import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
import org.hibernate.type.descriptor.java.MutabilityPlan; import org.hibernate.type.descriptor.java.MutabilityPlan;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
@ -67,7 +67,7 @@ import org.jboss.logging.Logger;
* @author Steve Ebersole * @author Steve Ebersole
* @author Emmanuel Bernard * @author Emmanuel Bernard
*/ */
public class BasicValueBinder<T> implements SqlTypeDescriptorIndicators { public class BasicValueBinder<T> implements JdbcTypeDescriptorIndicators {
// todo (6.0) : In light of how we want to build Types (specifically BasicTypes) moving forward this class should undergo major changes // 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 // see the comments in #setType
@ -97,7 +97,7 @@ public class BasicValueBinder<T> implements SqlTypeDescriptorIndicators {
private String explicitBasicTypeName; private String explicitBasicTypeName;
private Map explicitLocalTypeParams; private Map explicitLocalTypeParams;
private Function<TypeConfiguration,SqlTypeDescriptor> explicitSqlTypeAccess; private Function<TypeConfiguration, JdbcTypeDescriptor> explicitSqlTypeAccess;
private Function<TypeConfiguration, BasicJavaDescriptor> explicitJtdAccess; private Function<TypeConfiguration, BasicJavaDescriptor> explicitJtdAccess;
private Function<TypeConfiguration, MutabilityPlan> explicitMutabilityAccess; private Function<TypeConfiguration, MutabilityPlan> explicitMutabilityAccess;
private Function<TypeConfiguration, java.lang.reflect.Type> implicitJavaTypeAccess; private Function<TypeConfiguration, java.lang.reflect.Type> implicitJavaTypeAccess;
@ -508,10 +508,10 @@ public class BasicValueBinder<T> implements SqlTypeDescriptorIndicators {
} }
explicitSqlTypeAccess = typeConfiguration -> { explicitSqlTypeAccess = typeConfiguration -> {
final MapKeySqlType explicitDescriptorAnn = attributeXProperty.getAnnotation( MapKeySqlType.class ); final MapKeyJdbcType explicitDescriptorAnn = attributeXProperty.getAnnotation( MapKeyJdbcType.class );
if ( explicitDescriptorAnn != null ) { if ( explicitDescriptorAnn != null ) {
final SqlType explicitStdAnn = explicitDescriptorAnn.value(); final JdbcType explicitStdAnn = explicitDescriptorAnn.value();
final Class<? extends SqlTypeDescriptor> stdImplJavaType = explicitStdAnn.value(); final Class<? extends JdbcTypeDescriptor> stdImplJavaType = explicitStdAnn.value();
try { try {
return stdImplJavaType.newInstance(); return stdImplJavaType.newInstance();
@ -521,10 +521,10 @@ public class BasicValueBinder<T> implements SqlTypeDescriptorIndicators {
} }
} }
final MapKeySqlTypeCode explicitCodeAnn = attributeXProperty.getAnnotation( MapKeySqlTypeCode.class ); final MapKeyJdbcTypeCode explicitCodeAnn = attributeXProperty.getAnnotation( MapKeyJdbcTypeCode.class );
if ( explicitCodeAnn != null ) { if ( explicitCodeAnn != null ) {
final SqlTypeCode explicitSqlTypeAnn = explicitCodeAnn.value(); final JdbcTypeCode explicitSqlTypeAnn = explicitCodeAnn.value();
return typeConfiguration.getSqlTypeDescriptorRegistry().getDescriptor( explicitSqlTypeAnn.value() ); return typeConfiguration.getJdbcTypeDescriptorRegistry().getDescriptor( explicitSqlTypeAnn.value() );
} }
return null; return null;
@ -552,9 +552,9 @@ public class BasicValueBinder<T> implements SqlTypeDescriptorIndicators {
XProperty attributeXProperty, XProperty attributeXProperty,
MetadataBuildingContext buildingContext) { MetadataBuildingContext buildingContext) {
explicitSqlTypeAccess = typeConfiguration -> { explicitSqlTypeAccess = typeConfiguration -> {
final SqlType explicitStdAnn = attributeXProperty.getAnnotation( SqlType.class ); final JdbcType explicitStdAnn = attributeXProperty.getAnnotation( JdbcType.class );
if ( explicitStdAnn != null ) { if ( explicitStdAnn != null ) {
final Class<? extends SqlTypeDescriptor> stdImplJavaType = explicitStdAnn.value(); final Class<? extends JdbcTypeDescriptor> stdImplJavaType = explicitStdAnn.value();
try { try {
return stdImplJavaType.newInstance(); return stdImplJavaType.newInstance();
@ -564,9 +564,9 @@ public class BasicValueBinder<T> implements SqlTypeDescriptorIndicators {
} }
} }
final SqlTypeCode explicitSqlTypeAnn = attributeXProperty.getAnnotation( SqlTypeCode.class ); final JdbcTypeCode explicitSqlTypeAnn = attributeXProperty.getAnnotation( JdbcTypeCode.class );
if ( explicitSqlTypeAnn != null ) { if ( explicitSqlTypeAnn != null ) {
return typeConfiguration.getSqlTypeDescriptorRegistry().getDescriptor( explicitSqlTypeAnn.value() ); return typeConfiguration.getJdbcTypeDescriptorRegistry().getDescriptor( explicitSqlTypeAnn.value() );
} }
return null; return null;

View File

@ -55,7 +55,7 @@ import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.WrapperOptions; import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.DataHelper; import org.hibernate.type.descriptor.java.DataHelper;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.*; import org.hibernate.type.descriptor.jdbc.*;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@ -277,7 +277,7 @@ public abstract class AbstractHANADialect extends Dialect {
} }
} }
private static class HANAStreamBlobTypeDescriptor implements SqlTypeDescriptor { private static class HANAStreamBlobTypeDescriptor implements JdbcTypeDescriptor {
private static final long serialVersionUID = -2476600722093442047L; private static final long serialVersionUID = -2476600722093442047L;
@ -298,7 +298,7 @@ public abstract class AbstractHANADialect extends Dialect {
} }
@Override @Override
public int getSqlType() { public int getJdbcType() {
return Types.BLOB; return Types.BLOB;
} }
@ -569,7 +569,7 @@ public abstract class AbstractHANADialect extends Dialect {
} }
} }
public static class HANABlobTypeDescriptor implements SqlTypeDescriptor { public static class HANABlobTypeDescriptor implements JdbcTypeDescriptor {
private static final long serialVersionUID = 5874441715643764323L; private static final long serialVersionUID = 5874441715643764323L;
@ -583,7 +583,7 @@ public abstract class AbstractHANADialect extends Dialect {
} }
@Override @Override
public int getSqlType() { public int getJdbcType() {
return Types.BLOB; return Types.BLOB;
} }
@ -634,7 +634,7 @@ public abstract class AbstractHANADialect extends Dialect {
@Override @Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException { protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
SqlTypeDescriptor descriptor = BlobTypeDescriptor.BLOB_BINDING; JdbcTypeDescriptor descriptor = BlobTypeDescriptor.BLOB_BINDING;
if ( byte[].class.isInstance( value ) ) { if ( byte[].class.isInstance( value ) ) {
// performance shortcut for binding BLOB data in byte[] format // performance shortcut for binding BLOB data in byte[] format
descriptor = BlobTypeDescriptor.PRIMITIVE_ARRAY_BINDING; descriptor = BlobTypeDescriptor.PRIMITIVE_ARRAY_BINDING;
@ -647,7 +647,7 @@ public abstract class AbstractHANADialect extends Dialect {
@Override @Override
protected void doBind(CallableStatement st, X value, String name, WrapperOptions options) throws SQLException { protected void doBind(CallableStatement st, X value, String name, WrapperOptions options) throws SQLException {
SqlTypeDescriptor descriptor = BlobTypeDescriptor.BLOB_BINDING; JdbcTypeDescriptor descriptor = BlobTypeDescriptor.BLOB_BINDING;
if ( byte[].class.isInstance( value ) ) { if ( byte[].class.isInstance( value ) ) {
// performance shortcut for binding BLOB data in byte[] format // performance shortcut for binding BLOB data in byte[] format
descriptor = BlobTypeDescriptor.PRIMITIVE_ARRAY_BINDING; descriptor = BlobTypeDescriptor.PRIMITIVE_ARRAY_BINDING;
@ -1002,7 +1002,7 @@ public abstract class AbstractHANADialect extends Dialect {
} }
@Override @Override
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(final int sqlCode) { protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(final int sqlCode) {
switch ( sqlCode ) { switch ( sqlCode ) {
case Types.CLOB: case Types.CLOB:
return this.clobTypeDescriptor; return this.clobTypeDescriptor;
@ -1475,7 +1475,7 @@ public abstract class AbstractHANADialect extends Dialect {
} }
} }
public SqlTypeDescriptor getBlobTypeDescriptor() { public JdbcTypeDescriptor getBlobTypeDescriptor() {
return this.blobTypeDescriptor; return this.blobTypeDescriptor;
} }

View File

@ -24,8 +24,8 @@ import org.hibernate.query.sqm.mutation.internal.idtable.IdTable;
import org.hibernate.query.sqm.mutation.internal.idtable.LocalTemporaryTableStrategy; import org.hibernate.query.sqm.mutation.internal.idtable.LocalTemporaryTableStrategy;
import org.hibernate.query.sqm.mutation.internal.idtable.TempIdTableExporter; import org.hibernate.query.sqm.mutation.internal.idtable.TempIdTableExporter;
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy; import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import java.sql.CallableStatement; import java.sql.CallableStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -68,15 +68,15 @@ abstract class AbstractTransactSQLDialect extends Dialect {
} }
@Override @Override
public SqlTypeDescriptor resolveSqlTypeDescriptor( public JdbcTypeDescriptor resolveSqlTypeDescriptor(
int jdbcTypeCode, int jdbcTypeCode,
int precision, int precision,
int scale, int scale,
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) { JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
if ( jdbcTypeCode == Types.BIT ) { if ( jdbcTypeCode == Types.BIT ) {
return sqlTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN ); return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
} }
return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, sqlTypeDescriptorRegistry ); return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, jdbcTypeDescriptorRegistry );
} }
@Override @Override

View File

@ -27,8 +27,8 @@ import org.hibernate.sql.ast.tree.Statement;
import org.hibernate.sql.exec.spi.JdbcOperation; import org.hibernate.sql.exec.spi.JdbcOperation;
import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorCUBRIDDatabaseImpl; import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorCUBRIDDatabaseImpl;
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor; import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import java.sql.Types; import java.sql.Types;
@ -104,15 +104,15 @@ public class CUBRIDDialect extends Dialect {
} }
@Override @Override
public SqlTypeDescriptor resolveSqlTypeDescriptor( public JdbcTypeDescriptor resolveSqlTypeDescriptor(
int jdbcTypeCode, int jdbcTypeCode,
int precision, int precision,
int scale, int scale,
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) { JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
if ( jdbcTypeCode == Types.BIT ) { if ( jdbcTypeCode == Types.BIT ) {
return sqlTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN ); return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
} }
return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, sqlTypeDescriptorRegistry ); return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, jdbcTypeDescriptorRegistry );
} }
@Override @Override

View File

@ -34,8 +34,8 @@ import org.hibernate.sql.ast.spi.StandardSqlAstTranslatorFactory;
import org.hibernate.sql.ast.tree.Statement; import org.hibernate.sql.ast.tree.Statement;
import org.hibernate.sql.exec.spi.JdbcOperation; import org.hibernate.sql.exec.spi.JdbcOperation;
import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import java.sql.CallableStatement; import java.sql.CallableStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -87,15 +87,15 @@ public class CacheDialect extends Dialect {
} }
@Override @Override
public SqlTypeDescriptor resolveSqlTypeDescriptor( public JdbcTypeDescriptor resolveSqlTypeDescriptor(
int jdbcTypeCode, int jdbcTypeCode,
int precision, int precision,
int scale, int scale,
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) { JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
if ( jdbcTypeCode == Types.BIT ) { if ( jdbcTypeCode == Types.BIT ) {
return sqlTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN ); return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
} }
return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, sqlTypeDescriptorRegistry ); return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, jdbcTypeDescriptorRegistry );
} }
@Override @Override

View File

@ -41,7 +41,7 @@ import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorDB
import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorNoOpImpl; import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorNoOpImpl;
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor; import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.sql.*; import org.hibernate.type.descriptor.jdbc.*;
import java.sql.CallableStatement; import java.sql.CallableStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -520,7 +520,7 @@ public class DB2Dialect extends Dialect {
} }
@Override @Override
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) { protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
final int version = getVersion(); final int version = getVersion();
if ( version < 1100 && sqlCode == Types.BOOLEAN ) { if ( version < 1100 && sqlCode == Types.BOOLEAN ) {

View File

@ -52,10 +52,10 @@ import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorDe
import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorNoOpImpl; import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorNoOpImpl;
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor; import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.sql.DecimalTypeDescriptor; import org.hibernate.type.descriptor.jdbc.DecimalTypeDescriptor;
import org.hibernate.type.descriptor.sql.SmallIntTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.SmallIntTypeDescriptor;
import org.hibernate.type.descriptor.sql.TimestampTypeDescriptor; import org.hibernate.type.descriptor.jdbc.TimestampTypeDescriptor;
import java.sql.DatabaseMetaData; import java.sql.DatabaseMetaData;
import java.sql.SQLException; import java.sql.SQLException;
@ -487,7 +487,7 @@ public class DerbyDialect extends Dialect {
return false; return false;
} }
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) { protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
if ( getVersion() < 1070 && sqlCode == Types.BOOLEAN) { if ( getVersion() < 1070 && sqlCode == Types.BOOLEAN) {
return SmallIntTypeDescriptor.INSTANCE; return SmallIntTypeDescriptor.INSTANCE;
} }

View File

@ -83,9 +83,9 @@ import org.hibernate.tool.schema.spi.Exporter;
import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.Type; import org.hibernate.type.Type;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.ClobTypeDescriptor; import org.hibernate.type.descriptor.jdbc.ClobTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import java.io.InputStream; import java.io.InputStream;
@ -243,12 +243,12 @@ public abstract class Dialect implements ConversionContext {
sizeStrategy = new SizeStrategyImpl(); sizeStrategy = new SizeStrategyImpl();
} }
public SqlTypeDescriptor resolveSqlTypeDescriptor( public JdbcTypeDescriptor resolveSqlTypeDescriptor(
int jdbcTypeCode, int jdbcTypeCode,
int precision, int precision,
int scale, int scale,
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) { JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
return sqlTypeDescriptorRegistry.getDescriptor( jdbcTypeCode ); return jdbcTypeDescriptorRegistry.getDescriptor( jdbcTypeCode );
} }
/** /**
@ -1018,12 +1018,12 @@ public abstract class Dialect implements ConversionContext {
return paren>0 ? result.substring(0, paren) : result; return paren>0 ? result.substring(0, paren) : result;
} }
public String getRawTypeName(SqlTypeDescriptor sqlTypeDescriptor) throws HibernateException { public String getRawTypeName(JdbcTypeDescriptor jdbcTypeDescriptor) throws HibernateException {
return getRawTypeName( sqlTypeDescriptor.getJdbcTypeCode() ); return getRawTypeName( jdbcTypeDescriptor.getJdbcTypeCode() );
} }
public String getTypeName(SqlTypeDescriptor sqlTypeDescriptor) throws HibernateException { public String getTypeName(JdbcTypeDescriptor jdbcTypeDescriptor) throws HibernateException {
return getTypeName( sqlTypeDescriptor.getJdbcTypeCode() ); return getTypeName( jdbcTypeDescriptor.getJdbcTypeCode() );
} }
public String getTypeName(int code) throws HibernateException { public String getTypeName(int code) throws HibernateException {
@ -1081,14 +1081,14 @@ public abstract class Dialect implements ConversionContext {
* Get the name of the database type associated with the given * Get the name of the database type associated with the given
* <tt>SqlTypeDescriptor</tt>. * <tt>SqlTypeDescriptor</tt>.
* *
* @param sqlTypeDescriptor the SQL type * @param jdbcTypeDescriptor the SQL type
* @param size the length, precision, scale of the column * @param size the length, precision, scale of the column
* *
* @return the database type name * @return the database type name
* *
*/ */
public String getTypeName(SqlTypeDescriptor sqlTypeDescriptor, Size size) { public String getTypeName(JdbcTypeDescriptor jdbcTypeDescriptor, Size size) {
return getTypeName( sqlTypeDescriptor.getJdbcTypeCode(), size ); return getTypeName( jdbcTypeDescriptor.getJdbcTypeCode(), size );
} }
/** /**
@ -1103,7 +1103,7 @@ public abstract class Dialect implements ConversionContext {
if ( length == null && precision == null ) { if ( length == null && precision == null ) {
//use defaults //use defaults
size = getSizeStrategy().resolveSize( size = getSizeStrategy().resolveSize(
type.getJdbcMapping().getSqlTypeDescriptor(), type.getJdbcMapping().getJdbcTypeDescriptor(),
type.getJdbcMapping().getJavaTypeDescriptor(), type.getJdbcMapping().getJavaTypeDescriptor(),
precision, precision,
scale, scale,
@ -1122,7 +1122,7 @@ public abstract class Dialect implements ConversionContext {
.setScale( scale ); .setScale( scale );
} }
return getTypeName( type.getJdbcMapping().getSqlTypeDescriptor(), size ); return getTypeName( type.getJdbcMapping().getJdbcTypeDescriptor(), size );
} }
/** /**
@ -1150,44 +1150,44 @@ public abstract class Dialect implements ConversionContext {
} }
/** /**
* Allows the dialect to override a {@link SqlTypeDescriptor}. * Allows the dialect to override a {@link JdbcTypeDescriptor}.
* <p/> * <p/>
* If the passed {@code sqlTypeDescriptor} allows itself to be remapped (per * If the passed {@code sqlTypeDescriptor} allows itself to be remapped (per
* {@link SqlTypeDescriptor#canBeRemapped()}), then this method uses * {@link JdbcTypeDescriptor#canBeRemapped()}), then this method uses
* {@link #getSqlTypeDescriptorOverride} to get an optional override based on the SQL code returned by * {@link #getSqlTypeDescriptorOverride} to get an optional override based on the SQL code returned by
* {@link SqlTypeDescriptor#getJdbcTypeCode()}. * {@link JdbcTypeDescriptor#getJdbcTypeCode()}.
* <p/> * <p/>
* If this dialect does not provide an override or if the {@code sqlTypeDescriptor} does not allow itself to be * If this dialect does not provide an override or if the {@code sqlTypeDescriptor} does not allow itself to be
* remapped, then this method simply returns the original passed {@code sqlTypeDescriptor} * remapped, then this method simply returns the original passed {@code sqlTypeDescriptor}
* *
* @param sqlTypeDescriptor The {@link SqlTypeDescriptor} to override * @param jdbcTypeDescriptor The {@link JdbcTypeDescriptor} to override
* @return The {@link SqlTypeDescriptor} that should be used for this dialect; * @return The {@link JdbcTypeDescriptor} that should be used for this dialect;
* if there is no override, then original {@code sqlTypeDescriptor} is returned. * if there is no override, then original {@code sqlTypeDescriptor} is returned.
* @throws IllegalArgumentException if {@code sqlTypeDescriptor} is null. * @throws IllegalArgumentException if {@code sqlTypeDescriptor} is null.
* *
* @see #getSqlTypeDescriptorOverride * @see #getSqlTypeDescriptorOverride
*/ */
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) { public JdbcTypeDescriptor remapSqlTypeDescriptor(JdbcTypeDescriptor jdbcTypeDescriptor) {
if ( sqlTypeDescriptor == null ) { if ( jdbcTypeDescriptor == null ) {
throw new IllegalArgumentException( "sqlTypeDescriptor is null" ); throw new IllegalArgumentException( "sqlTypeDescriptor is null" );
} }
if ( ! sqlTypeDescriptor.canBeRemapped() ) { if ( ! jdbcTypeDescriptor.canBeRemapped() ) {
return sqlTypeDescriptor; return jdbcTypeDescriptor;
} }
final SqlTypeDescriptor overridden = getSqlTypeDescriptorOverride( sqlTypeDescriptor.getJdbcTypeCode() ); final JdbcTypeDescriptor overridden = getSqlTypeDescriptorOverride( jdbcTypeDescriptor.getJdbcTypeCode() );
return overridden == null ? sqlTypeDescriptor : overridden; return overridden == null ? jdbcTypeDescriptor : overridden;
} }
/** /**
* Returns the {@link SqlTypeDescriptor} that should be used to handle the given JDBC type code. Returns * Returns the {@link JdbcTypeDescriptor} that should be used to handle the given JDBC type code. Returns
* {@code null} if there is no override. * {@code null} if there is no override.
* *
* @param sqlCode A {@link Types} constant indicating the SQL column type * @param sqlCode A {@link Types} constant indicating the SQL column type
* @return The {@link SqlTypeDescriptor} to use as an override, or {@code null} if there is no override. * @return The {@link JdbcTypeDescriptor} to use as an override, or {@code null} if there is no override.
*/ */
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) { protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
SqlTypeDescriptor descriptor; JdbcTypeDescriptor descriptor;
switch ( sqlCode ) { switch ( sqlCode ) {
case Types.CLOB: { case Types.CLOB: {
descriptor = useInputStreamToInsertBlob() ? ClobTypeDescriptor.STREAM_BINDING : null; descriptor = useInputStreamToInsertBlob() ? ClobTypeDescriptor.STREAM_BINDING : null;
@ -3717,12 +3717,12 @@ public abstract class Dialect implements ConversionContext {
public interface SizeStrategy { public interface SizeStrategy {
/** /**
* Resolve the {@link Size} to use for columns of the given * Resolve the {@link Size} to use for columns of the given
* {@link SqlTypeDescriptor SQL type} and {@link JavaTypeDescriptor Java type}. * {@link JdbcTypeDescriptor SQL type} and {@link JavaTypeDescriptor Java type}.
* *
* @return a non-null {@link Size} * @return a non-null {@link Size}
*/ */
Size resolveSize( Size resolveSize(
SqlTypeDescriptor sqlType, JdbcTypeDescriptor jdbcType,
JavaTypeDescriptor javaType, JavaTypeDescriptor javaType,
Integer precision, Integer precision,
Integer scale, Long length); Integer scale, Long length);
@ -3731,13 +3731,13 @@ public abstract class Dialect implements ConversionContext {
public class SizeStrategyImpl implements SizeStrategy { public class SizeStrategyImpl implements SizeStrategy {
@Override @Override
public Size resolveSize( public Size resolveSize(
SqlTypeDescriptor sqlType, JdbcTypeDescriptor jdbcType,
JavaTypeDescriptor javaType, JavaTypeDescriptor javaType,
Integer precision, Integer precision,
Integer scale, Integer scale,
Long length) { Long length) {
final Size size = new Size(); final Size size = new Size();
int jdbcTypeCode = sqlType.getJdbcTypeCode(); int jdbcTypeCode = jdbcType.getJdbcTypeCode();
switch (jdbcTypeCode) { switch (jdbcTypeCode) {
case Types.BIT: case Types.BIT:

View File

@ -50,8 +50,8 @@ import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorFi
import org.hibernate.tool.schema.extract.internal.SequenceNameExtractorImpl; import org.hibernate.tool.schema.extract.internal.SequenceNameExtractorImpl;
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor; import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import java.sql.DatabaseMetaData; import java.sql.DatabaseMetaData;
import java.sql.SQLException; import java.sql.SQLException;
@ -162,15 +162,15 @@ public class FirebirdDialect extends Dialect {
} }
@Override @Override
public SqlTypeDescriptor resolveSqlTypeDescriptor( public JdbcTypeDescriptor resolveSqlTypeDescriptor(
int jdbcTypeCode, int jdbcTypeCode,
int precision, int precision,
int scale, int scale,
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) { JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
if ( jdbcTypeCode == Types.BIT ) { if ( jdbcTypeCode == Types.BIT ) {
return sqlTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN ); return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
} }
return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, sqlTypeDescriptorRegistry ); return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, jdbcTypeDescriptorRegistry );
} }
@Override @Override

View File

@ -35,8 +35,8 @@ import org.hibernate.sql.exec.spi.JdbcOperation;
import org.hibernate.tool.schema.extract.internal.SequenceNameExtractorImpl; import org.hibernate.tool.schema.extract.internal.SequenceNameExtractorImpl;
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor; import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import java.sql.Types; import java.sql.Types;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
@ -159,15 +159,15 @@ public class IngresDialect extends Dialect {
} }
@Override @Override
public SqlTypeDescriptor resolveSqlTypeDescriptor( public JdbcTypeDescriptor resolveSqlTypeDescriptor(
int jdbcTypeCode, int jdbcTypeCode,
int precision, int precision,
int scale, int scale,
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) { JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
if ( jdbcTypeCode == Types.BIT ) { if ( jdbcTypeCode == Types.BIT ) {
return sqlTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN ); return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
} }
return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, sqlTypeDescriptorRegistry ); return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, jdbcTypeDescriptorRegistry );
} }
@Override @Override

View File

@ -29,8 +29,8 @@ import org.hibernate.sql.exec.spi.JdbcOperation;
import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorSAPDBDatabaseImpl; import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorSAPDBDatabaseImpl;
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor; import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import java.sql.DatabaseMetaData; import java.sql.DatabaseMetaData;
import java.sql.Types; import java.sql.Types;
@ -64,19 +64,19 @@ public class MaxDBDialect extends Dialect {
} }
@Override @Override
public SqlTypeDescriptor resolveSqlTypeDescriptor( public JdbcTypeDescriptor resolveSqlTypeDescriptor(
int jdbcTypeCode, int jdbcTypeCode,
int precision, int precision,
int scale, int scale,
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) { JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
switch ( jdbcTypeCode ) { switch ( jdbcTypeCode ) {
case Types.NUMERIC: case Types.NUMERIC:
case Types.DECIMAL: case Types.DECIMAL:
if ( precision == 19 && scale == 0 ) { if ( precision == 19 && scale == 0 ) {
return sqlTypeDescriptorRegistry.getDescriptor( Types.BIGINT ); return jdbcTypeDescriptorRegistry.getDescriptor( Types.BIGINT );
} }
} }
return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, sqlTypeDescriptorRegistry ); return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, jdbcTypeDescriptorRegistry );
} }
@Override @Override

View File

@ -48,8 +48,8 @@ import org.hibernate.sql.ast.tree.Statement;
import org.hibernate.sql.exec.spi.JdbcOperation; import org.hibernate.sql.exec.spi.JdbcOperation;
import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import java.sql.CallableStatement; import java.sql.CallableStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -169,12 +169,12 @@ public class MySQLDialect extends Dialect {
sizeStrategy = new SizeStrategyImpl() { sizeStrategy = new SizeStrategyImpl() {
@Override @Override
public Size resolveSize( public Size resolveSize(
SqlTypeDescriptor sqlType, JdbcTypeDescriptor jdbcType,
JavaTypeDescriptor javaType, JavaTypeDescriptor javaType,
Integer precision, Integer precision,
Integer scale, Integer scale,
Long length) { Long length) {
final int jdbcTypeCode = sqlType.getSqlType(); final int jdbcTypeCode = jdbcType.getJdbcType();
switch ( jdbcTypeCode ) { switch ( jdbcTypeCode ) {
case Types.BIT: case Types.BIT:
// MySQL allows BIT with a length up to 64 // MySQL allows BIT with a length up to 64
@ -182,7 +182,7 @@ public class MySQLDialect extends Dialect {
return Size.length( Math.min( Math.max( length, 1 ), 64 ) ); return Size.length( Math.min( Math.max( length, 1 ), 64 ) );
} }
} }
return super.resolveSize( sqlType, javaType, precision, scale, length ); return super.resolveSize( jdbcType, javaType, precision, scale, length );
} }
}; };
} }
@ -208,15 +208,15 @@ public class MySQLDialect extends Dialect {
} }
@Override @Override
public SqlTypeDescriptor resolveSqlTypeDescriptor( public JdbcTypeDescriptor resolveSqlTypeDescriptor(
int jdbcTypeCode, int jdbcTypeCode,
int precision, int precision,
int scale, int scale,
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) { JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
if ( jdbcTypeCode == Types.BIT ) { if ( jdbcTypeCode == Types.BIT ) {
return sqlTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN ); return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
} }
return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, sqlTypeDescriptorRegistry ); return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, jdbcTypeDescriptorRegistry );
} }
@Override @Override
@ -575,7 +575,7 @@ public class MySQLDialect extends Dialect {
@Override @Override
public String getCastTypeName(SqlExpressable type, Long length, Integer precision, Integer scale) { public String getCastTypeName(SqlExpressable type, Long length, Integer precision, Integer scale) {
switch ( type.getJdbcMapping().getSqlTypeDescriptor().getJdbcTypeCode() ) { switch ( type.getJdbcMapping().getJdbcTypeDescriptor().getJdbcTypeCode() ) {
case Types.INTEGER: case Types.INTEGER:
case Types.BIGINT: case Types.BIGINT:
case Types.SMALLINT: case Types.SMALLINT:

View File

@ -61,11 +61,11 @@ import org.hibernate.type.descriptor.JdbcTypeNameMapper;
import org.hibernate.type.descriptor.ValueBinder; import org.hibernate.type.descriptor.ValueBinder;
import org.hibernate.type.descriptor.WrapperOptions; import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.BasicBinder; import org.hibernate.type.descriptor.jdbc.BasicBinder;
import org.hibernate.type.descriptor.sql.BlobTypeDescriptor; import org.hibernate.type.descriptor.jdbc.BlobTypeDescriptor;
import org.hibernate.type.descriptor.sql.BooleanTypeDescriptor; import org.hibernate.type.descriptor.jdbc.BooleanTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import java.sql.CallableStatement; import java.sql.CallableStatement;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -600,11 +600,11 @@ public class OracleDialect extends Dialect {
} }
@Override @Override
public SqlTypeDescriptor resolveSqlTypeDescriptor( public JdbcTypeDescriptor resolveSqlTypeDescriptor(
int jdbcTypeCode, int jdbcTypeCode,
int precision, int precision,
int scale, int scale,
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) { JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
// This is the reverse of what registerNumericTypeMappings registers // This is the reverse of what registerNumericTypeMappings registers
switch ( jdbcTypeCode ) { switch ( jdbcTypeCode ) {
case Types.NUMERIC: case Types.NUMERIC:
@ -612,19 +612,19 @@ public class OracleDialect extends Dialect {
if ( scale == 0 ) { if ( scale == 0 ) {
switch ( precision ) { switch ( precision ) {
case 1: case 1:
return sqlTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN ); return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
case 3: case 3:
return sqlTypeDescriptorRegistry.getDescriptor( Types.TINYINT ); return jdbcTypeDescriptorRegistry.getDescriptor( Types.TINYINT );
case 5: case 5:
return sqlTypeDescriptorRegistry.getDescriptor( Types.SMALLINT ); return jdbcTypeDescriptorRegistry.getDescriptor( Types.SMALLINT );
case 10: case 10:
return sqlTypeDescriptorRegistry.getDescriptor( Types.INTEGER ); return jdbcTypeDescriptorRegistry.getDescriptor( Types.INTEGER );
case 19: case 19:
return sqlTypeDescriptorRegistry.getDescriptor( Types.BIGINT ); return jdbcTypeDescriptorRegistry.getDescriptor( Types.BIGINT );
} }
} }
} }
return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, sqlTypeDescriptorRegistry ); return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, jdbcTypeDescriptorRegistry );
} }
/** /**
@ -654,9 +654,9 @@ public class OracleDialect extends Dialect {
BlobTypeDescriptor.PRIMITIVE_ARRAY_BINDING : BlobTypeDescriptor.PRIMITIVE_ARRAY_BINDING :
BlobTypeDescriptor.DEFAULT; BlobTypeDescriptor.DEFAULT;
typeContributions.contributeSqlTypeDescriptor( descriptor ); typeContributions.contributeJdbcTypeDescriptor( descriptor );
} }
typeContributions.contributeSqlTypeDescriptor( new OracleBooleanTypeDescriptor() ); typeContributions.contributeJdbcTypeDescriptor( new OracleBooleanTypeDescriptor() );
} }
private static final class OracleBooleanTypeDescriptor extends BooleanTypeDescriptor { private static final class OracleBooleanTypeDescriptor extends BooleanTypeDescriptor {

View File

@ -47,12 +47,13 @@ import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.WrapperOptions; import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.BasicJavaDescriptor; import org.hibernate.type.descriptor.java.BasicJavaDescriptor;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.BasicBinder; import org.hibernate.type.descriptor.jdbc.BasicBinder;
import org.hibernate.type.descriptor.sql.BasicExtractor; import org.hibernate.type.descriptor.jdbc.BasicExtractor;
import org.hibernate.type.descriptor.sql.BlobTypeDescriptor; import org.hibernate.type.descriptor.jdbc.BlobTypeDescriptor;
import org.hibernate.type.descriptor.sql.ClobTypeDescriptor; import org.hibernate.type.descriptor.jdbc.ClobTypeDescriptor;
import org.hibernate.type.descriptor.sql.JdbcLiteralFormatter; import org.hibernate.type.descriptor.jdbc.JdbcLiteralFormatter;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
import java.sql.*; import java.sql.*;
@ -327,7 +328,7 @@ public class PostgreSQLDialect extends Dialect {
} }
@Override @Override
public SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) { public JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
// For discussion of BLOB support in Postgres, as of 8.4, have a peek at // 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>. // <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> // For the effects in regards to Hibernate see <a href="http://in.relation.to/15492.lace">http://in.relation.to/15492.lace</a>
@ -822,11 +823,11 @@ public class PostgreSQLDialect extends Dialect {
if ( getVersion() >= 820 ) { if ( getVersion() >= 820 ) {
// HHH-9562 // HHH-9562
typeContributions.contributeSqlTypeDescriptor( PostgresUUIDType.INSTANCE ); typeContributions.contributeJdbcTypeDescriptor( PostgresUUIDType.INSTANCE );
} }
} }
private static class PostgresUUIDType implements SqlTypeDescriptor { private static class PostgresUUIDType implements JdbcTypeDescriptor {
/** /**
* Singleton access * Singleton access
*/ */
@ -837,18 +838,18 @@ public class PostgreSQLDialect extends Dialect {
* it reports a lot of its types as {@link java.sql.Types#OTHER}, making that * it reports a lot of its types as {@link java.sql.Types#OTHER}, making that
* value useless for distinguishing one SqlTypeDescriptor from another. * value useless for distinguishing one SqlTypeDescriptor from another.
* So here we define a "magic value" that is a (hopefully no collisions) * So here we define a "magic value" that is a (hopefully no collisions)
* unique key within the {@link org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry} * unique key within the {@link JdbcTypeDescriptorRegistry}
*/ */
private static final int JDBC_TYPE_CODE = 3975; private static final int JDBC_TYPE_CODE = 3975;
@Override @Override
public int getSqlType() { public int getJdbcType() {
return JDBC_TYPE_CODE; return JDBC_TYPE_CODE;
} }
@Override @Override
public int getJdbcTypeCode() { public int getJdbcTypeCode() {
return getSqlType(); return getJdbcType();
} }
@Override @Override

View File

@ -26,8 +26,8 @@ import org.hibernate.sql.ast.SqlAstTranslatorFactory;
import org.hibernate.sql.ast.spi.StandardSqlAstTranslatorFactory; import org.hibernate.sql.ast.spi.StandardSqlAstTranslatorFactory;
import org.hibernate.sql.ast.tree.Statement; import org.hibernate.sql.ast.tree.Statement;
import org.hibernate.sql.exec.spi.JdbcOperation; import org.hibernate.sql.exec.spi.JdbcOperation;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
@ -110,15 +110,15 @@ public class RDMSOS2200Dialect extends Dialect {
} }
@Override @Override
public SqlTypeDescriptor resolveSqlTypeDescriptor( public JdbcTypeDescriptor resolveSqlTypeDescriptor(
int jdbcTypeCode, int jdbcTypeCode,
int precision, int precision,
int scale, int scale,
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) { JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
if ( jdbcTypeCode == Types.BIT ) { if ( jdbcTypeCode == Types.BIT ) {
return sqlTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN ); return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
} }
return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, sqlTypeDescriptorRegistry ); return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, jdbcTypeDescriptorRegistry );
} }
@Override @Override

View File

@ -33,8 +33,8 @@ import org.hibernate.sql.ast.spi.StandardSqlAstTranslatorFactory;
import org.hibernate.sql.ast.tree.Statement; import org.hibernate.sql.ast.tree.Statement;
import org.hibernate.sql.exec.spi.JdbcOperation; import org.hibernate.sql.exec.spi.JdbcOperation;
import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.sql.SmallIntTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.SmallIntTypeDescriptor;
import java.sql.Types; import java.sql.Types;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -129,7 +129,7 @@ public class SQLServerDialect extends AbstractTransactSQLDialect {
} }
@Override @Override
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) { protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
return sqlCode == Types.TINYINT return sqlCode == Types.TINYINT
? SmallIntTypeDescriptor.INSTANCE ? SmallIntTypeDescriptor.INSTANCE
: super.getSqlTypeDescriptorOverride( sqlCode ); : super.getSqlTypeDescriptorOverride( sqlCode );

View File

@ -788,7 +788,7 @@ public class SpannerDialect extends Dialect {
@Override @Override
public String getCastTypeName(SqlExpressable type, Long length, Integer precision, Integer scale) { public String getCastTypeName(SqlExpressable type, Long length, Integer precision, Integer scale) {
//Spanner doesn't let you specify a length in cast() types //Spanner doesn't let you specify a length in cast() types
return super.getRawTypeName( type.getJdbcMapping().getSqlTypeDescriptor() ); return super.getRawTypeName( type.getJdbcMapping().getJdbcTypeDescriptor() );
} }
/** /**

View File

@ -26,8 +26,8 @@ import org.hibernate.sql.ast.SqlAstTranslatorFactory;
import org.hibernate.sql.ast.spi.StandardSqlAstTranslatorFactory; import org.hibernate.sql.ast.spi.StandardSqlAstTranslatorFactory;
import org.hibernate.sql.ast.tree.Statement; import org.hibernate.sql.ast.tree.Statement;
import org.hibernate.sql.exec.spi.JdbcOperation; import org.hibernate.sql.exec.spi.JdbcOperation;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.TinyIntTypeDescriptor; import org.hibernate.type.descriptor.jdbc.TinyIntTypeDescriptor;
import java.sql.Types; import java.sql.Types;
import java.util.Map; import java.util.Map;
@ -100,7 +100,7 @@ public class SybaseASEDialect extends SybaseDialect {
} }
@Override @Override
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) { protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
return sqlCode == Types.BOOLEAN return sqlCode == Types.BOOLEAN
? TinyIntTypeDescriptor.INSTANCE ? TinyIntTypeDescriptor.INSTANCE
: super.getSqlTypeDescriptorOverride( sqlCode ); : super.getSqlTypeDescriptorOverride( sqlCode );

View File

@ -16,10 +16,10 @@ import org.hibernate.sql.ast.SqlAstTranslatorFactory;
import org.hibernate.sql.ast.spi.StandardSqlAstTranslatorFactory; import org.hibernate.sql.ast.spi.StandardSqlAstTranslatorFactory;
import org.hibernate.sql.ast.tree.Statement; import org.hibernate.sql.ast.tree.Statement;
import org.hibernate.sql.exec.spi.JdbcOperation; import org.hibernate.sql.exec.spi.JdbcOperation;
import org.hibernate.type.descriptor.sql.BlobTypeDescriptor; import org.hibernate.type.descriptor.jdbc.BlobTypeDescriptor;
import org.hibernate.type.descriptor.sql.ClobTypeDescriptor; import org.hibernate.type.descriptor.jdbc.ClobTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import java.sql.Types; import java.sql.Types;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
@ -53,19 +53,19 @@ public class SybaseDialect extends AbstractTransactSQLDialect {
} }
@Override @Override
public SqlTypeDescriptor resolveSqlTypeDescriptor( public JdbcTypeDescriptor resolveSqlTypeDescriptor(
int jdbcTypeCode, int jdbcTypeCode,
int precision, int precision,
int scale, int scale,
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) { JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
switch ( jdbcTypeCode ) { switch ( jdbcTypeCode ) {
case Types.NUMERIC: case Types.NUMERIC:
case Types.DECIMAL: case Types.DECIMAL:
if ( precision == 19 && scale == 0 ) { if ( precision == 19 && scale == 0 ) {
return sqlTypeDescriptorRegistry.getDescriptor( Types.BIGINT ); return jdbcTypeDescriptorRegistry.getDescriptor( Types.BIGINT );
} }
} }
return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, sqlTypeDescriptorRegistry ); return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, jdbcTypeDescriptorRegistry );
} }
@Override @Override
@ -90,7 +90,7 @@ public class SybaseDialect extends AbstractTransactSQLDialect {
} }
@Override @Override
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) { protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
switch (sqlCode) { switch (sqlCode) {
case Types.BLOB: case Types.BLOB:
return BlobTypeDescriptor.PRIMITIVE_ARRAY_BINDING; return BlobTypeDescriptor.PRIMITIVE_ARRAY_BINDING;

View File

@ -43,8 +43,8 @@ import org.hibernate.sql.exec.spi.JdbcOperation;
import org.hibernate.tool.schema.internal.StandardIndexExporter; import org.hibernate.tool.schema.internal.StandardIndexExporter;
import org.hibernate.tool.schema.spi.Exporter; import org.hibernate.tool.schema.spi.Exporter;
import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import java.sql.CallableStatement; import java.sql.CallableStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -123,21 +123,21 @@ public class TeradataDialect extends Dialect {
} }
@Override @Override
public SqlTypeDescriptor resolveSqlTypeDescriptor( public JdbcTypeDescriptor resolveSqlTypeDescriptor(
int jdbcTypeCode, int jdbcTypeCode,
int precision, int precision,
int scale, int scale,
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) { JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
switch ( jdbcTypeCode ) { switch ( jdbcTypeCode ) {
case Types.BIT: case Types.BIT:
return sqlTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN ); return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
case Types.NUMERIC: case Types.NUMERIC:
case Types.DECIMAL: case Types.DECIMAL:
if ( precision == 19 && scale == 0 ) { if ( precision == 19 && scale == 0 ) {
return sqlTypeDescriptorRegistry.getDescriptor( Types.BIGINT ); return jdbcTypeDescriptorRegistry.getDescriptor( Types.BIGINT );
} }
} }
return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, sqlTypeDescriptorRegistry ); return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, jdbcTypeDescriptorRegistry );
} }
@Override @Override

View File

@ -33,8 +33,8 @@ import org.hibernate.sql.exec.spi.JdbcOperation;
import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorTimesTenDatabaseImpl; import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorTimesTenDatabaseImpl;
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor; import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import java.sql.Types; import java.sql.Types;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
@ -98,15 +98,15 @@ public class TimesTenDialect extends Dialect {
} }
@Override @Override
public SqlTypeDescriptor resolveSqlTypeDescriptor( public JdbcTypeDescriptor resolveSqlTypeDescriptor(
int jdbcTypeCode, int jdbcTypeCode,
int precision, int precision,
int scale, int scale,
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) { JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
if ( jdbcTypeCode == Types.BIT ) { if ( jdbcTypeCode == Types.BIT ) {
return sqlTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN ); return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
} }
return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, sqlTypeDescriptorRegistry ); return super.resolveSqlTypeDescriptor( jdbcTypeCode, precision, scale, jdbcTypeDescriptorRegistry );
} }
@Override @Override

View File

@ -10,7 +10,7 @@ import java.util.TimeZone;
import org.hibernate.engine.jdbc.LobCreator; import org.hibernate.engine.jdbc.LobCreator;
import org.hibernate.type.descriptor.WrapperOptions; import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
/** /**
* @author Christian Beikov * @author Christian Beikov
@ -34,8 +34,8 @@ public abstract class AbstractDelegatingWrapperOptions implements WrapperOptions
} }
@Override @Override
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) { public JdbcTypeDescriptor remapSqlTypeDescriptor(JdbcTypeDescriptor jdbcTypeDescriptor) {
return delegate().remapSqlTypeDescriptor( sqlTypeDescriptor ); return delegate().remapSqlTypeDescriptor( jdbcTypeDescriptor );
} }
@Override @Override

View File

@ -60,7 +60,7 @@ import org.hibernate.query.sql.spi.NativeQueryImplementor;
import org.hibernate.resource.jdbc.spi.JdbcSessionContext; import org.hibernate.resource.jdbc.spi.JdbcSessionContext;
import org.hibernate.resource.transaction.spi.TransactionCoordinator; import org.hibernate.resource.transaction.spi.TransactionCoordinator;
import org.hibernate.stat.SessionStatistics; import org.hibernate.stat.SessionStatistics;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
/** /**
* This class is meant to be extended. * This class is meant to be extended.
@ -1101,8 +1101,8 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
} }
@Override @Override
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) { public JdbcTypeDescriptor remapSqlTypeDescriptor(JdbcTypeDescriptor jdbcTypeDescriptor) {
return delegate.remapSqlTypeDescriptor( sqlTypeDescriptor ); return delegate.remapSqlTypeDescriptor( jdbcTypeDescriptor );
} }
@Override @Override

View File

@ -26,7 +26,6 @@ import org.hibernate.FlushMode;
import org.hibernate.Hibernate; import org.hibernate.Hibernate;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.Interceptor; import org.hibernate.Interceptor;
import org.hibernate.LockMode;
import org.hibernate.MultiTenancyStrategy; import org.hibernate.MultiTenancyStrategy;
import org.hibernate.NotYetImplementedFor6Exception; import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.SessionEventListener; import org.hibernate.SessionEventListener;
@ -81,7 +80,7 @@ import org.hibernate.resource.jdbc.spi.StatementInspector;
import org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorImpl; import org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorImpl;
import org.hibernate.resource.transaction.spi.TransactionCoordinator; import org.hibernate.resource.transaction.spi.TransactionCoordinator;
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder; import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
/** /**
* Base class for SharedSessionContract/SharedSessionContractImplementor * Base class for SharedSessionContract/SharedSessionContractImplementor
@ -581,8 +580,8 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
} }
@Override @Override
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) { public JdbcTypeDescriptor remapSqlTypeDescriptor(JdbcTypeDescriptor jdbcTypeDescriptor) {
return fastSessionServices.remapSqlTypeDescriptor( sqlTypeDescriptor ); return fastSessionServices.remapSqlTypeDescriptor( jdbcTypeDescriptor );
} }
@Override @Override

View File

@ -66,7 +66,7 @@ import org.hibernate.jpa.internal.util.ConfigurationHelper;
import org.hibernate.jpa.internal.util.LockOptionsHelper; import org.hibernate.jpa.internal.util.LockOptionsHelper;
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder; import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.spi.ServiceRegistryImplementor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import static org.hibernate.cfg.AvailableSettings.JPA_LOCK_SCOPE; import static org.hibernate.cfg.AvailableSettings.JPA_LOCK_SCOPE;
import static org.hibernate.cfg.AvailableSettings.JPA_LOCK_TIMEOUT; import static org.hibernate.cfg.AvailableSettings.JPA_LOCK_TIMEOUT;
@ -248,13 +248,13 @@ public final class FastSessionServices {
return elr.getEventListenerGroup( type ); return elr.getEventListenerGroup( type );
} }
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) { public JdbcTypeDescriptor remapSqlTypeDescriptor(JdbcTypeDescriptor jdbcTypeDescriptor) {
if ( !sqlTypeDescriptor.canBeRemapped() ) { if ( !jdbcTypeDescriptor.canBeRemapped() ) {
return sqlTypeDescriptor; return jdbcTypeDescriptor;
} }
final SqlTypeDescriptor remapped = dialect.remapSqlTypeDescriptor( sqlTypeDescriptor ); final JdbcTypeDescriptor remapped = dialect.remapSqlTypeDescriptor( jdbcTypeDescriptor );
return remapped == null ? sqlTypeDescriptor : remapped; return remapped == null ? jdbcTypeDescriptor : remapped;
} }
private static boolean isTransactionAccessible(SessionFactoryImpl sf, TransactionCoordinatorBuilder transactionCoordinatorBuilder) { private static boolean isTransactionAccessible(SessionFactoryImpl sf, TransactionCoordinatorBuilder transactionCoordinatorBuilder) {

View File

@ -44,15 +44,15 @@ import org.hibernate.type.descriptor.java.EnumJavaTypeDescriptor;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.java.MutabilityPlan; import org.hibernate.type.descriptor.java.MutabilityPlan;
import org.hibernate.type.descriptor.java.TemporalJavaTypeDescriptor; import org.hibernate.type.descriptor.java.TemporalJavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
/** /**
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@SuppressWarnings({"unchecked", "rawtypes"}) @SuppressWarnings({"unchecked", "rawtypes"})
public class BasicValue extends SimpleValue implements SqlTypeDescriptorIndicators, Resolvable { public class BasicValue extends SimpleValue implements JdbcTypeDescriptorIndicators, Resolvable {
private static final CoreMessageLogger log = CoreLogging.messageLogger( BasicValue.class ); private static final CoreMessageLogger log = CoreLogging.messageLogger( BasicValue.class );
private final TypeConfiguration typeConfiguration; private final TypeConfiguration typeConfiguration;
@ -65,7 +65,7 @@ public class BasicValue extends SimpleValue implements SqlTypeDescriptorIndicato
private Map explicitLocalTypeParams; private Map explicitLocalTypeParams;
private Function<TypeConfiguration, BasicJavaDescriptor> explicitJavaTypeAccess; private Function<TypeConfiguration, BasicJavaDescriptor> explicitJavaTypeAccess;
private Function<TypeConfiguration, SqlTypeDescriptor> explicitSqlTypeAccess; private Function<TypeConfiguration, JdbcTypeDescriptor> explicitSqlTypeAccess;
private Function<TypeConfiguration, MutabilityPlan> explicitMutabilityPlanAccess; private Function<TypeConfiguration, MutabilityPlan> explicitMutabilityPlanAccess;
private Function<TypeConfiguration, java.lang.reflect.Type> implicitJavaTypeAccess; private Function<TypeConfiguration, java.lang.reflect.Type> implicitJavaTypeAccess;
@ -132,7 +132,7 @@ public class BasicValue extends SimpleValue implements SqlTypeDescriptorIndicato
this.explicitJavaTypeAccess = explicitJavaTypeAccess; this.explicitJavaTypeAccess = explicitJavaTypeAccess;
} }
public void setExplicitSqlTypeAccess(Function<TypeConfiguration, SqlTypeDescriptor> sqlTypeAccess) { public void setExplicitSqlTypeAccess(Function<TypeConfiguration, JdbcTypeDescriptor> sqlTypeAccess) {
this.explicitSqlTypeAccess = sqlTypeAccess; this.explicitSqlTypeAccess = sqlTypeAccess;
} }
@ -255,7 +255,7 @@ public class BasicValue extends SimpleValue implements SqlTypeDescriptorIndicato
if ( column instanceof Column && resolution.getValueConverter() == null ) { if ( column instanceof Column && resolution.getValueConverter() == null ) {
final Column physicalColumn = (Column) column; final Column physicalColumn = (Column) column;
if ( physicalColumn.getSqlTypeCode() == null ) { if ( physicalColumn.getSqlTypeCode() == null ) {
physicalColumn.setSqlTypeCode( resolution.getRelationalSqlTypeDescriptor().getJdbcTypeCode() ); physicalColumn.setSqlTypeCode( resolution.getJdbcTypeDescriptor().getJdbcTypeCode() );
} }
final BasicType<?> basicType = resolution.getLegacyResolvedBasicType(); final BasicType<?> basicType = resolution.getLegacyResolvedBasicType();
@ -265,7 +265,7 @@ public class BasicValue extends SimpleValue implements SqlTypeDescriptorIndicato
physicalColumn.setCheckConstraint( physicalColumn.setCheckConstraint(
basicType.getJavaTypeDescriptor().getCheckCondition( basicType.getJavaTypeDescriptor().getCheckCondition(
physicalColumn.getQuotedName( dialect ), physicalColumn.getQuotedName( dialect ),
basicType.getSqlTypeDescriptor(), basicType.getJdbcTypeDescriptor(),
dialect dialect
) )
); );
@ -443,11 +443,11 @@ public class BasicValue extends SimpleValue implements SqlTypeDescriptorIndicato
EnumType enumerationStyle, EnumType enumerationStyle,
Function<TypeConfiguration, java.lang.reflect.Type> implicitJavaTypeAccess, Function<TypeConfiguration, java.lang.reflect.Type> implicitJavaTypeAccess,
Function<TypeConfiguration, BasicJavaDescriptor> explicitJtdAccess, Function<TypeConfiguration, BasicJavaDescriptor> explicitJtdAccess,
Function<TypeConfiguration, SqlTypeDescriptor> explicitStdAccess, Function<TypeConfiguration, JdbcTypeDescriptor> explicitStdAccess,
Function<TypeConfiguration, MutabilityPlan> explicitMutabilityPlanAccess, Function<TypeConfiguration, MutabilityPlan> explicitMutabilityPlanAccess,
ConverterDescriptor converterDescriptor, ConverterDescriptor converterDescriptor,
Map localTypeParams, Map localTypeParams,
SqlTypeDescriptorIndicators stdIndicators, JdbcTypeDescriptorIndicators stdIndicators,
TypeConfiguration typeConfiguration, TypeConfiguration typeConfiguration,
MetadataBuildingContext context) { MetadataBuildingContext context) {
@ -666,7 +666,7 @@ public class BasicValue extends SimpleValue implements SqlTypeDescriptorIndicato
* The JavaTypeDescriptor for the relational value as part of * The JavaTypeDescriptor for the relational value as part of
* the relational model (its JDBC representation) * the relational model (its JDBC representation)
*/ */
SqlTypeDescriptor getRelationalSqlTypeDescriptor(); JdbcTypeDescriptor getJdbcTypeDescriptor();
/** /**
* Converter, if any, to convert values between the * Converter, if any, to convert values between the

View File

@ -268,7 +268,7 @@ public class Column implements Selectable, Serializable, Cloneable {
type = getTypeForComponentValue( mapping, type, getTypeIndex() ); type = getTypeForComponentValue( mapping, type, getTypeIndex() );
} }
return dialect.getSizeStrategy().resolveSize( return dialect.getSizeStrategy().resolveSize(
( (JdbcMapping) type ).getSqlTypeDescriptor(), ( (JdbcMapping) type ).getJdbcTypeDescriptor(),
( (JdbcMapping) type ).getJavaTypeDescriptor(), ( (JdbcMapping) type ).getJavaTypeDescriptor(),
precision, precision,
scale, scale,

View File

@ -47,12 +47,12 @@ import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistry;
import org.hibernate.type.Type; import org.hibernate.type.Type;
import org.hibernate.type.descriptor.JdbcTypeNameMapper; import org.hibernate.type.descriptor.JdbcTypeNameMapper;
import org.hibernate.type.descriptor.converter.AttributeConverterSqlTypeDescriptorAdapter; import org.hibernate.type.descriptor.converter.AttributeConverterJdbcTypeDescriptorAdapter;
import org.hibernate.type.descriptor.converter.AttributeConverterTypeAdapter; import org.hibernate.type.descriptor.converter.AttributeConverterTypeAdapter;
import org.hibernate.type.descriptor.java.BasicJavaDescriptor; import org.hibernate.type.descriptor.java.BasicJavaDescriptor;
import org.hibernate.type.descriptor.sql.LobTypeMappings; import org.hibernate.type.descriptor.jdbc.LobTypeMappings;
import org.hibernate.type.descriptor.sql.NationalizedTypeMappings; import org.hibernate.type.descriptor.jdbc.NationalizedTypeMappings;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
import org.hibernate.usertype.DynamicParameterizedType; import org.hibernate.usertype.DynamicParameterizedType;
@ -627,11 +627,11 @@ public abstract class SimpleValue implements KeyValue {
// corresponding to the AttributeConverter's declared "databaseColumnJavaType" (how we read that value out // corresponding to the AttributeConverter's declared "databaseColumnJavaType" (how we read that value out
// of ResultSets). See JdbcTypeJavaClassMappings for details. Again, given example, this should return // of ResultSets). See JdbcTypeJavaClassMappings for details. Again, given example, this should return
// VARCHAR/CHAR // VARCHAR/CHAR
final SqlTypeDescriptor recommendedSqlType = jpaAttributeConverter.getRelationalJavaTypeDescriptor().getJdbcRecommendedSqlType( final JdbcTypeDescriptor recommendedJdbcType = jpaAttributeConverter.getRelationalJavaTypeDescriptor().getRecommendedJdbcType(
// todo (6.0) : handle the other JdbcRecommendedSqlTypeMappingContext methods // todo (6.0) : handle the other JdbcRecommendedSqlTypeMappingContext methods
metadata::getTypeConfiguration metadata::getTypeConfiguration
); );
int jdbcTypeCode = recommendedSqlType.getSqlType(); int jdbcTypeCode = recommendedJdbcType.getJdbcType();
if ( isLob() ) { if ( isLob() ) {
if ( LobTypeMappings.isMappedToKnownLobCode( jdbcTypeCode ) ) { if ( LobTypeMappings.isMappedToKnownLobCode( jdbcTypeCode ) ) {
jdbcTypeCode = LobTypeMappings.getLobCodeTypeMapping( jdbcTypeCode ); jdbcTypeCode = LobTypeMappings.getLobCodeTypeMapping( jdbcTypeCode );
@ -657,7 +657,7 @@ public abstract class SimpleValue implements KeyValue {
} }
// find the standard SqlTypeDescriptor for that JDBC type code (allow it to be remapped if needed!) // find the standard SqlTypeDescriptor for that JDBC type code (allow it to be remapped if needed!)
final SqlTypeDescriptor sqlTypeDescriptor = getMetadata() final JdbcTypeDescriptor jdbcTypeDescriptor = getMetadata()
.getMetadataBuildingOptions() .getMetadataBuildingOptions()
.getServiceRegistry() .getServiceRegistry()
.getService( JdbcServices.class ) .getService( JdbcServices.class )
@ -665,14 +665,14 @@ public abstract class SimpleValue implements KeyValue {
.getDialect() .getDialect()
.remapSqlTypeDescriptor( .remapSqlTypeDescriptor(
metadata.getTypeConfiguration() metadata.getTypeConfiguration()
.getSqlTypeDescriptorRegistry() .getJdbcTypeDescriptorRegistry()
.getDescriptor( jdbcTypeCode ) ); .getDescriptor( jdbcTypeCode ) );
// and finally construct the adapter, which injects the AttributeConverter calls into the binding/extraction // and finally construct the adapter, which injects the AttributeConverter calls into the binding/extraction
// process... // process...
final SqlTypeDescriptor sqlTypeDescriptorAdapter = new AttributeConverterSqlTypeDescriptorAdapter( final JdbcTypeDescriptor jdbcTypeDescriptorAdapter = new AttributeConverterJdbcTypeDescriptorAdapter(
jpaAttributeConverter, jpaAttributeConverter,
sqlTypeDescriptor, jdbcTypeDescriptor,
jpaAttributeConverter.getRelationalJavaTypeDescriptor() jpaAttributeConverter.getRelationalJavaTypeDescriptor()
); );
@ -688,7 +688,7 @@ public abstract class SimpleValue implements KeyValue {
name, name,
description, description,
jpaAttributeConverter, jpaAttributeConverter,
sqlTypeDescriptorAdapter, jdbcTypeDescriptorAdapter,
jpaAttributeConverter.getRelationalJavaTypeDescriptor(), jpaAttributeConverter.getRelationalJavaTypeDescriptor(),
jpaAttributeConverter.getDomainJavaTypeDescriptor(), jpaAttributeConverter.getDomainJavaTypeDescriptor(),
null null

View File

@ -10,7 +10,7 @@ import org.hibernate.query.CastType;
import org.hibernate.type.descriptor.ValueBinder; import org.hibernate.type.descriptor.ValueBinder;
import org.hibernate.type.descriptor.ValueExtractor; import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
/** /**
* Models the type of a thing that can be used as an expression in a SQL query * Models the type of a thing that can be used as an expression in a SQL query
@ -28,10 +28,10 @@ public interface JdbcMapping extends MappingType {
* The descriptor for the SQL type represented by this * The descriptor for the SQL type represented by this
* expressable type * expressable type
*/ */
SqlTypeDescriptor getSqlTypeDescriptor(); JdbcTypeDescriptor getJdbcTypeDescriptor();
default CastType getCastType() { default CastType getCastType() {
return getSqlTypeDescriptor().getCastType(); return getJdbcTypeDescriptor().getCastType();
} }
/** /**

View File

@ -370,7 +370,7 @@ public class MappingModelCreationHelper {
.getBasicTypeRegistry() .getBasicTypeRegistry()
.resolve( .resolve(
valueConverter.getRelationalJavaDescriptor(), valueConverter.getRelationalJavaDescriptor(),
resolution.getRelationalSqlTypeDescriptor() resolution.getJdbcTypeDescriptor()
); );

View File

@ -11,7 +11,6 @@ import java.io.ObjectInputStream;
import java.io.Serializable; import java.io.Serializable;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Types;
import java.util.Locale; import java.util.Locale;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
@ -20,7 +19,7 @@ import org.hibernate.type.descriptor.ValueBinder;
import org.hibernate.type.descriptor.ValueExtractor; import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.java.EnumJavaTypeDescriptor; import org.hibernate.type.descriptor.java.EnumJavaTypeDescriptor;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
/** /**
* BasicValueConverter handling the conversion of an enum based on * BasicValueConverter handling the conversion of an enum based on
@ -30,7 +29,7 @@ import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
*/ */
public class NamedEnumValueConverter<E extends Enum<E>> implements EnumValueConverter<E,String>, Serializable { public class NamedEnumValueConverter<E extends Enum<E>> implements EnumValueConverter<E,String>, Serializable {
private final EnumJavaTypeDescriptor<E> domainTypeDescriptor; private final EnumJavaTypeDescriptor<E> domainTypeDescriptor;
private final SqlTypeDescriptor sqlTypeDescriptor; private final JdbcTypeDescriptor jdbcTypeDescriptor;
private final JavaTypeDescriptor<String> relationalTypeDescriptor; private final JavaTypeDescriptor<String> relationalTypeDescriptor;
private transient ValueExtractor<String> valueExtractor; private transient ValueExtractor<String> valueExtractor;
@ -38,14 +37,14 @@ public class NamedEnumValueConverter<E extends Enum<E>> implements EnumValueConv
public NamedEnumValueConverter( public NamedEnumValueConverter(
EnumJavaTypeDescriptor<E> domainTypeDescriptor, EnumJavaTypeDescriptor<E> domainTypeDescriptor,
SqlTypeDescriptor sqlTypeDescriptor, JdbcTypeDescriptor jdbcTypeDescriptor,
JavaTypeDescriptor<String> relationalTypeDescriptor) { JavaTypeDescriptor<String> relationalTypeDescriptor) {
this.domainTypeDescriptor = domainTypeDescriptor; this.domainTypeDescriptor = domainTypeDescriptor;
this.sqlTypeDescriptor = sqlTypeDescriptor; this.jdbcTypeDescriptor = jdbcTypeDescriptor;
this.relationalTypeDescriptor = relationalTypeDescriptor; this.relationalTypeDescriptor = relationalTypeDescriptor;
this.valueExtractor = sqlTypeDescriptor.getExtractor( relationalTypeDescriptor ); this.valueExtractor = jdbcTypeDescriptor.getExtractor( relationalTypeDescriptor );
this.valueBinder = sqlTypeDescriptor.getBinder( relationalTypeDescriptor ); this.valueBinder = jdbcTypeDescriptor.getBinder( relationalTypeDescriptor );
} }
@Override @Override
@ -70,7 +69,7 @@ public class NamedEnumValueConverter<E extends Enum<E>> implements EnumValueConv
@Override @Override
public int getJdbcTypeCode() { public int getJdbcTypeCode() {
return sqlTypeDescriptor.getJdbcTypeCode(); return jdbcTypeDescriptor.getJdbcTypeCode();
} }
@Override @Override
@ -82,8 +81,8 @@ public class NamedEnumValueConverter<E extends Enum<E>> implements EnumValueConv
private void readObject(ObjectInputStream stream) throws ClassNotFoundException, IOException { private void readObject(ObjectInputStream stream) throws ClassNotFoundException, IOException {
stream.defaultReadObject(); stream.defaultReadObject();
this.valueExtractor = sqlTypeDescriptor.getExtractor( relationalTypeDescriptor ); this.valueExtractor = jdbcTypeDescriptor.getExtractor( relationalTypeDescriptor );
this.valueBinder = sqlTypeDescriptor.getBinder( relationalTypeDescriptor ); this.valueBinder = jdbcTypeDescriptor.getBinder( relationalTypeDescriptor );
} }
@Override @Override

View File

@ -19,7 +19,7 @@ import org.hibernate.type.descriptor.ValueBinder;
import org.hibernate.type.descriptor.ValueExtractor; import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.java.EnumJavaTypeDescriptor; import org.hibernate.type.descriptor.java.EnumJavaTypeDescriptor;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
/** /**
* BasicValueConverter handling the conversion of an enum based on * BasicValueConverter handling the conversion of an enum based on
@ -30,7 +30,7 @@ import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
public class OrdinalEnumValueConverter<E extends Enum<E>> implements EnumValueConverter<E,Integer>, Serializable { public class OrdinalEnumValueConverter<E extends Enum<E>> implements EnumValueConverter<E,Integer>, Serializable {
private final EnumJavaTypeDescriptor<E> enumJavaDescriptor; private final EnumJavaTypeDescriptor<E> enumJavaDescriptor;
private final SqlTypeDescriptor sqlTypeDescriptor; private final JdbcTypeDescriptor jdbcTypeDescriptor;
private final JavaTypeDescriptor<Integer> relationalJavaDescriptor; private final JavaTypeDescriptor<Integer> relationalJavaDescriptor;
private transient ValueExtractor<Integer> valueExtractor; private transient ValueExtractor<Integer> valueExtractor;
@ -38,14 +38,14 @@ public class OrdinalEnumValueConverter<E extends Enum<E>> implements EnumValueCo
public OrdinalEnumValueConverter( public OrdinalEnumValueConverter(
EnumJavaTypeDescriptor<E> enumJavaDescriptor, EnumJavaTypeDescriptor<E> enumJavaDescriptor,
SqlTypeDescriptor sqlTypeDescriptor, JdbcTypeDescriptor jdbcTypeDescriptor,
JavaTypeDescriptor<Integer> relationalJavaDescriptor) { JavaTypeDescriptor<Integer> relationalJavaDescriptor) {
this.enumJavaDescriptor = enumJavaDescriptor; this.enumJavaDescriptor = enumJavaDescriptor;
this.sqlTypeDescriptor = sqlTypeDescriptor; this.jdbcTypeDescriptor = jdbcTypeDescriptor;
this.relationalJavaDescriptor = relationalJavaDescriptor; this.relationalJavaDescriptor = relationalJavaDescriptor;
this.valueExtractor = sqlTypeDescriptor.getExtractor( relationalJavaDescriptor ); this.valueExtractor = jdbcTypeDescriptor.getExtractor( relationalJavaDescriptor );
this.valueBinder = sqlTypeDescriptor.getBinder( relationalJavaDescriptor ); this.valueBinder = jdbcTypeDescriptor.getBinder( relationalJavaDescriptor );
} }
@Override @Override
@ -85,8 +85,8 @@ public class OrdinalEnumValueConverter<E extends Enum<E>> implements EnumValueCo
private void readObject(ObjectInputStream stream) throws ClassNotFoundException, IOException { private void readObject(ObjectInputStream stream) throws ClassNotFoundException, IOException {
stream.defaultReadObject(); stream.defaultReadObject();
this.valueExtractor = sqlTypeDescriptor.getExtractor( relationalJavaDescriptor ); this.valueExtractor = jdbcTypeDescriptor.getExtractor( relationalJavaDescriptor );
this.valueBinder = sqlTypeDescriptor.getBinder( relationalJavaDescriptor ); this.valueBinder = jdbcTypeDescriptor.getBinder( relationalJavaDescriptor );
} }
@Override @Override

View File

@ -10,13 +10,13 @@ import java.sql.CallableStatement;
import java.sql.SQLException; import java.sql.SQLException;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
/** /**
* Specialization of DomainType for types that can be used as a * Specialization of DomainType for types that can be used as a
* parameter output for a {@link org.hibernate.procedure.ProcedureCall} * parameter output for a {@link org.hibernate.procedure.ProcedureCall}
* *
* @apiNote We assume a type that maps to exactly one SQL value, hence {@link #getSqlTypeDescriptor()} * @apiNote We assume a type that maps to exactly one SQL value, hence {@link #getJdbcTypeDescriptor()}
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@ -31,7 +31,7 @@ public interface AllowableOutputParameterType<J> extends AllowableParameterType<
/** /**
* Descriptor for the SQL type mapped by this type. * Descriptor for the SQL type mapped by this type.
*/ */
SqlTypeDescriptor getSqlTypeDescriptor(); JdbcTypeDescriptor getJdbcTypeDescriptor();
/** /**
* Perform the extraction * Perform the extraction

View File

@ -14,7 +14,7 @@ import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.metamodel.model.domain.BasicDomainType; import org.hibernate.metamodel.model.domain.BasicDomainType;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
/** /**
* @author Emmanuel Bernard * @author Emmanuel Bernard
@ -45,7 +45,7 @@ public class BasicTypeImpl<J> implements BasicDomainType<J>, Serializable {
} }
@Override @Override
public SqlTypeDescriptor getSqlTypeDescriptor() { public JdbcTypeDescriptor getJdbcTypeDescriptor() {
throw new NotYetImplementedFor6Exception( getClass() ); throw new NotYetImplementedFor6Exception( getClass() );
} }

View File

@ -32,7 +32,7 @@ public class FunctionReturnImpl implements FunctionReturnImplementor {
public FunctionReturnImpl(ProcedureCallImplementor procedureCall, AllowableOutputParameterType ormType) { public FunctionReturnImpl(ProcedureCallImplementor procedureCall, AllowableOutputParameterType ormType) {
this.procedureCall = procedureCall; this.procedureCall = procedureCall;
this.jdbcTypeCode = ormType.getSqlTypeDescriptor().getSqlType(); this.jdbcTypeCode = ormType.getJdbcTypeDescriptor().getJdbcType();
this.ormType = ormType; this.ormType = ormType;
} }

View File

@ -57,7 +57,7 @@ public class TempIdTableExporter implements IdTableExporter {
} }
buffer.append( column.getColumnName() ).append( ' ' ); buffer.append( column.getColumnName() ).append( ' ' );
final int sqlTypeCode = column.getJdbcMapping().getSqlTypeDescriptor().getSqlType(); final int sqlTypeCode = column.getJdbcMapping().getJdbcTypeDescriptor().getJdbcType();
final String databaseTypeName = databaseTypeNameResolver.apply( sqlTypeCode ); final String databaseTypeName = databaseTypeNameResolver.apply( sqlTypeCode );
buffer.append( " " ).append( databaseTypeName ).append( " " ); buffer.append( " " ).append( databaseTypeName ).append( " " );

View File

@ -137,8 +137,8 @@ public class StandardFunctionReturnTypeResolvers {
//that is determined by how the function is used in the HQL query. In essence //that is determined by how the function is used in the HQL query. In essence
//the types are compatible if the map to the same JDBC type, of if they are //the types are compatible if the map to the same JDBC type, of if they are
//both numeric types. //both numeric types.
int impliedTypeCode = ((BasicType<?>) implied).getJdbcMapping().getSqlTypeDescriptor().getJdbcTypeCode(); int impliedTypeCode = ((BasicType<?>) implied).getJdbcMapping().getJdbcTypeDescriptor().getJdbcTypeCode();
int definedTypeCode = ((BasicType<?>) defined).getJdbcMapping().getSqlTypeDescriptor().getJdbcTypeCode(); int definedTypeCode = ((BasicType<?>) defined).getJdbcMapping().getJdbcTypeDescriptor().getJdbcTypeCode();
return impliedTypeCode == definedTypeCode return impliedTypeCode == definedTypeCode
|| isNumeric( impliedTypeCode ) && isNumeric( definedTypeCode ); || isNumeric( impliedTypeCode ) && isNumeric( definedTypeCode );
} }
@ -177,8 +177,8 @@ public class StandardFunctionReturnTypeResolvers {
//that is determined by how the function is used in the HQL query. In essence //that is determined by how the function is used in the HQL query. In essence
//the types are compatible if the map to the same JDBC type, of if they are //the types are compatible if the map to the same JDBC type, of if they are
//both numeric types. //both numeric types.
int impliedTypeCode = implied.getJdbcMapping().getSqlTypeDescriptor().getJdbcTypeCode(); int impliedTypeCode = implied.getJdbcMapping().getJdbcTypeDescriptor().getJdbcTypeCode();
int definedTypeCode = defined.getJdbcMapping().getSqlTypeDescriptor().getJdbcTypeCode(); int definedTypeCode = defined.getJdbcMapping().getJdbcTypeDescriptor().getJdbcTypeCode();
return impliedTypeCode == definedTypeCode return impliedTypeCode == definedTypeCode
|| isNumeric( impliedTypeCode ) && isNumeric( definedTypeCode ); || isNumeric( impliedTypeCode ) && isNumeric( definedTypeCode );

View File

@ -275,7 +275,7 @@ import org.hibernate.sql.results.internal.StandardEntityGraphTraversalStateImpl;
import org.hibernate.type.BasicType; import org.hibernate.type.BasicType;
import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
@ -293,7 +293,7 @@ import static org.hibernate.type.spi.TypeConfiguration.isDuration;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends BaseSemanticQueryWalker public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends BaseSemanticQueryWalker
implements SqmTranslator<T>, DomainResultCreationState, SqlTypeDescriptorIndicators { implements SqmTranslator<T>, DomainResultCreationState, JdbcTypeDescriptorIndicators {
private static final Logger log = Logger.getLogger( BaseSqmToSqlAstConverter.class ); private static final Logger log = Logger.getLogger( BaseSqmToSqlAstConverter.class );

View File

@ -141,8 +141,8 @@ import org.hibernate.sql.results.jdbc.internal.JdbcValuesMappingProducerStandard
import org.hibernate.type.IntegerType; import org.hibernate.type.IntegerType;
import org.hibernate.type.StringType; import org.hibernate.type.StringType;
import org.hibernate.type.descriptor.WrapperOptions; import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.sql.JdbcLiteralFormatter; import org.hibernate.type.descriptor.jdbc.JdbcLiteralFormatter;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import static org.hibernate.query.TemporalUnit.NANOSECOND; import static org.hibernate.query.TemporalUnit.NANOSECOND;
import static org.hibernate.sql.ast.SqlTreePrinter.logSqlAst; import static org.hibernate.sql.ast.SqlTreePrinter.logSqlAst;
@ -261,8 +261,8 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
} }
@Override @Override
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) { public JdbcTypeDescriptor remapSqlTypeDescriptor(JdbcTypeDescriptor jdbcTypeDescriptor) {
return sessionFactory.getFastSessionServices().remapSqlTypeDescriptor( sqlTypeDescriptor ); return sessionFactory.getFastSessionServices().remapSqlTypeDescriptor( jdbcTypeDescriptor );
} }
@Override @Override
@ -2442,7 +2442,7 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
final JdbcMapping jdbcMapping = literal.getJdbcMapping(); final JdbcMapping jdbcMapping = literal.getJdbcMapping();
final JdbcLiteralFormatter literalFormatter = jdbcMapping final JdbcLiteralFormatter literalFormatter = jdbcMapping
.getSqlTypeDescriptor() .getJdbcTypeDescriptor()
.getJdbcLiteralFormatter( jdbcMapping.getJavaTypeDescriptor() ); .getJdbcLiteralFormatter( jdbcMapping.getJavaTypeDescriptor() );
// If we encounter a plain literal in the select clause which has no literal formatter, we must render it as parameter // If we encounter a plain literal in the select clause which has no literal formatter, we must render it as parameter
@ -2774,13 +2774,13 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
final JdbcMapping jdbcMapping = jdbcParameter.getExpressionType().getJdbcMappings().get( 0 ); final JdbcMapping jdbcMapping = jdbcParameter.getExpressionType().getJdbcMappings().get( 0 );
// We try to avoid inlining parameters if possible which can be done by wrapping the parameter // We try to avoid inlining parameters if possible which can be done by wrapping the parameter
// in an expression that is semantically unnecessary e.g. numeric + 0 or concat with an empty string // in an expression that is semantically unnecessary e.g. numeric + 0 or concat with an empty string
if ( jdbcMapping.getSqlTypeDescriptor().isNumber() ) { if ( jdbcMapping.getJdbcTypeDescriptor().isNumber() ) {
appendSql( '(' ); appendSql( '(' );
sqlAstNode.accept( this ); sqlAstNode.accept( this );
appendSql( "+0)" ); appendSql( "+0)" );
break; break;
} }
else if ( jdbcMapping.getSqlTypeDescriptor().isString() ) { else if ( jdbcMapping.getJdbcTypeDescriptor().isString() ) {
final SqmFunctionDescriptor sqmFunctionDescriptor = getSessionFactory().getQueryEngine() final SqmFunctionDescriptor sqmFunctionDescriptor = getSessionFactory().getQueryEngine()
.getSqmFunctionRegistry() .getSqmFunctionRegistry()
.findFunctionDescriptor( "concat" ); .findFunctionDescriptor( "concat" );
@ -3253,7 +3253,7 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
else { else {
assert jdbcParameter.getExpressionType().getJdbcTypeCount() == 1; assert jdbcParameter.getExpressionType().getJdbcTypeCount() == 1;
final JdbcMapping jdbcMapping = jdbcParameter.getExpressionType().getJdbcMappings().get( 0 ); final JdbcMapping jdbcMapping = jdbcParameter.getExpressionType().getJdbcMappings().get( 0 );
final JdbcLiteralFormatter literalFormatter = jdbcMapping.getSqlTypeDescriptor().getJdbcLiteralFormatter( jdbcMapping.getJavaTypeDescriptor() ); final JdbcLiteralFormatter literalFormatter = jdbcMapping.getJdbcTypeDescriptor().getJdbcLiteralFormatter( jdbcMapping.getJavaTypeDescriptor() );
if ( literalFormatter == null ) { if ( literalFormatter == null ) {
throw new IllegalArgumentException( "Can't render parameter as literal, no literal formatter found" ); throw new IllegalArgumentException( "Can't render parameter as literal, no literal formatter found" );
} }

View File

@ -15,7 +15,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata; import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
import org.hibernate.type.BasicType; import org.hibernate.type.BasicType;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
/** /**
@ -73,23 +73,23 @@ public interface ResultSetAccess extends JdbcValuesMetadata {
try { try {
final TypeConfiguration typeConfiguration = getFactory().getTypeConfiguration(); final TypeConfiguration typeConfiguration = getFactory().getTypeConfiguration();
final ResultSetMetaData metaData = getResultSet().getMetaData(); final ResultSetMetaData metaData = getResultSet().getMetaData();
final SqlTypeDescriptor sqlTypeDescriptor = jdbcServices.getDialect() final JdbcTypeDescriptor jdbcTypeDescriptor = jdbcServices.getDialect()
.resolveSqlTypeDescriptor( .resolveSqlTypeDescriptor(
metaData.getColumnType( position ), metaData.getColumnType( position ),
metaData.getPrecision( position ), metaData.getPrecision( position ),
metaData.getScale( position ), metaData.getScale( position ),
typeConfiguration.getSqlTypeDescriptorRegistry() typeConfiguration.getJdbcTypeDescriptorRegistry()
); );
final JavaTypeDescriptor<J> javaTypeDescriptor; final JavaTypeDescriptor<J> javaTypeDescriptor;
if ( explicitJavaTypeDescriptor == null ) { if ( explicitJavaTypeDescriptor == null ) {
javaTypeDescriptor = sqlTypeDescriptor.getJdbcRecommendedJavaTypeMapping( typeConfiguration ); javaTypeDescriptor = jdbcTypeDescriptor.getJdbcRecommendedJavaTypeMapping( typeConfiguration );
} }
else { else {
javaTypeDescriptor = explicitJavaTypeDescriptor; javaTypeDescriptor = explicitJavaTypeDescriptor;
} }
return typeConfiguration.getBasicTypeRegistry().resolve( return typeConfiguration.getBasicTypeRegistry().resolve(
javaTypeDescriptor, javaTypeDescriptor,
sqlTypeDescriptor jdbcTypeDescriptor
); );
} }
catch (SQLException e) { catch (SQLException e) {

View File

@ -8,8 +8,6 @@ package org.hibernate.sql.results.jdbc.spi;
import org.hibernate.type.BasicType; import org.hibernate.type.BasicType;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
import org.hibernate.type.spi.TypeConfiguration;
/** /**
* Access to information about the underlying JDBC values * Access to information about the underlying JDBC values

View File

@ -12,7 +12,7 @@ import java.sql.SQLException;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
/** /**
* TODO : javadoc * TODO : javadoc
@ -23,13 +23,13 @@ public abstract class AbstractSingleColumnStandardBasicType<T>
extends AbstractStandardBasicType<T> extends AbstractStandardBasicType<T>
implements SingleColumnType<T> { implements SingleColumnType<T> {
public AbstractSingleColumnStandardBasicType(SqlTypeDescriptor sqlTypeDescriptor, JavaTypeDescriptor<T> javaTypeDescriptor) { public AbstractSingleColumnStandardBasicType(JdbcTypeDescriptor jdbcTypeDescriptor, JavaTypeDescriptor<T> javaTypeDescriptor) {
super( sqlTypeDescriptor, javaTypeDescriptor ); super( jdbcTypeDescriptor, javaTypeDescriptor );
} }
@Override @Override
public final int sqlType() { public final int sqlType() {
return getSqlTypeDescriptor().getSqlType(); return getJdbcTypeDescriptor().getJdbcType();
} }
@Override @Override

View File

@ -28,7 +28,7 @@ import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.WrapperOptions; import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.java.MutabilityPlan; import org.hibernate.type.descriptor.java.MutabilityPlan;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
/** /**
* Convenience base class for {@link BasicType} implementations * Convenience base class for {@link BasicType} implementations
@ -44,7 +44,7 @@ public abstract class AbstractStandardBasicType<T>
// Don't use final here. Need to initialize after-the-fact // Don't use final here. Need to initialize after-the-fact
// by DynamicParameterizedTypes. // by DynamicParameterizedTypes.
private SqlTypeDescriptor sqlTypeDescriptor; private JdbcTypeDescriptor jdbcTypeDescriptor;
private JavaTypeDescriptor<T> javaTypeDescriptor; private JavaTypeDescriptor<T> javaTypeDescriptor;
// sqlTypes need always to be in sync with sqlTypeDescriptor // sqlTypes need always to be in sync with sqlTypeDescriptor
private int[] sqlTypes; private int[] sqlTypes;
@ -52,13 +52,13 @@ public abstract class AbstractStandardBasicType<T>
private ValueBinder<T> jdbcValueBinder; private ValueBinder<T> jdbcValueBinder;
private ValueExtractor<T> jdbcValueExtractor; private ValueExtractor<T> jdbcValueExtractor;
public AbstractStandardBasicType(SqlTypeDescriptor sqlTypeDescriptor, JavaTypeDescriptor<T> javaTypeDescriptor) { public AbstractStandardBasicType(JdbcTypeDescriptor jdbcTypeDescriptor, JavaTypeDescriptor<T> javaTypeDescriptor) {
this.sqlTypeDescriptor = sqlTypeDescriptor; this.jdbcTypeDescriptor = jdbcTypeDescriptor;
this.sqlTypes = new int[] { sqlTypeDescriptor.getSqlType() }; this.sqlTypes = new int[] { jdbcTypeDescriptor.getJdbcType() };
this.javaTypeDescriptor = javaTypeDescriptor; this.javaTypeDescriptor = javaTypeDescriptor;
this.jdbcValueBinder = sqlTypeDescriptor.getBinder( javaTypeDescriptor ); this.jdbcValueBinder = jdbcTypeDescriptor.getBinder( javaTypeDescriptor );
this.jdbcValueExtractor = sqlTypeDescriptor.getExtractor( javaTypeDescriptor ); this.jdbcValueExtractor = jdbcTypeDescriptor.getExtractor( javaTypeDescriptor );
} }
@Override @Override
@ -146,20 +146,20 @@ public abstract class AbstractStandardBasicType<T>
public final void setJavaTypeDescriptor( JavaTypeDescriptor<T> javaTypeDescriptor ) { public final void setJavaTypeDescriptor( JavaTypeDescriptor<T> javaTypeDescriptor ) {
this.javaTypeDescriptor = javaTypeDescriptor; this.javaTypeDescriptor = javaTypeDescriptor;
this.jdbcValueBinder = getSqlTypeDescriptor().getBinder( javaTypeDescriptor ); this.jdbcValueBinder = getJdbcTypeDescriptor().getBinder( javaTypeDescriptor );
this.jdbcValueExtractor = getSqlTypeDescriptor().getExtractor( javaTypeDescriptor ); this.jdbcValueExtractor = getJdbcTypeDescriptor().getExtractor( javaTypeDescriptor );
} }
public final SqlTypeDescriptor getSqlTypeDescriptor() { public final JdbcTypeDescriptor getJdbcTypeDescriptor() {
return sqlTypeDescriptor; return jdbcTypeDescriptor;
} }
public final void setSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) { public final void setSqlTypeDescriptor(JdbcTypeDescriptor jdbcTypeDescriptor) {
this.sqlTypeDescriptor = sqlTypeDescriptor; this.jdbcTypeDescriptor = jdbcTypeDescriptor;
this.sqlTypes = new int[] { sqlTypeDescriptor.getSqlType() }; this.sqlTypes = new int[] { jdbcTypeDescriptor.getJdbcType() };
this.jdbcValueBinder = getSqlTypeDescriptor().getBinder( javaTypeDescriptor ); this.jdbcValueBinder = getJdbcTypeDescriptor().getBinder( javaTypeDescriptor );
this.jdbcValueExtractor = getSqlTypeDescriptor().getExtractor( javaTypeDescriptor ); this.jdbcValueExtractor = getJdbcTypeDescriptor().getExtractor( javaTypeDescriptor );
} }
@Override @Override
@ -310,8 +310,8 @@ public abstract class AbstractStandardBasicType<T>
remapSqlTypeDescriptor( options ).getBinder( javaTypeDescriptor ).bind( st, ( T ) value, index, options ); remapSqlTypeDescriptor( options ).getBinder( javaTypeDescriptor ).bind( st, ( T ) value, index, options );
} }
protected SqlTypeDescriptor remapSqlTypeDescriptor(WrapperOptions options) { protected JdbcTypeDescriptor remapSqlTypeDescriptor(WrapperOptions options) {
return options.remapSqlTypeDescriptor( sqlTypeDescriptor ); return options.remapSqlTypeDescriptor( jdbcTypeDescriptor );
} }
public void set(PreparedStatement st, T value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException { public void set(PreparedStatement st, T value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {

View File

@ -19,7 +19,7 @@ public class AdaptedImmutableType<T> extends AbstractSingleColumnStandardBasicTy
private final AbstractStandardBasicType<T> baseMutableType; private final AbstractStandardBasicType<T> baseMutableType;
public AdaptedImmutableType(AbstractStandardBasicType<T> baseMutableType) { public AdaptedImmutableType(AbstractStandardBasicType<T> baseMutableType) {
super( baseMutableType.getSqlTypeDescriptor(), baseMutableType.getJavaTypeDescriptor() ); super( baseMutableType.getJdbcTypeDescriptor(), baseMutableType.getJavaTypeDescriptor() );
this.baseMutableType = baseMutableType; this.baseMutableType = baseMutableType;
} }

View File

@ -53,13 +53,13 @@ public interface BasicType<T> extends Type, BasicDomainType<T>, MappingType, Bas
@Override @Override
default ValueExtractor getJdbcValueExtractor() { default ValueExtractor getJdbcValueExtractor() {
//noinspection unchecked //noinspection unchecked
return getSqlTypeDescriptor().getExtractor( getMappedJavaTypeDescriptor() ); return getJdbcTypeDescriptor().getExtractor( getMappedJavaTypeDescriptor() );
} }
@Override @Override
default ValueBinder getJdbcValueBinder() { default ValueBinder getJdbcValueBinder() {
//noinspection unchecked //noinspection unchecked
return getSqlTypeDescriptor().getBinder( getMappedJavaTypeDescriptor() ); return getJdbcTypeDescriptor().getBinder( getMappedJavaTypeDescriptor() );
} }
@Override @Override

View File

@ -17,7 +17,7 @@ import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.StringHelper; import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.collections.CollectionHelper; import org.hibernate.internal.util.collections.CollectionHelper;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.internal.StandardBasicTypeImpl; import org.hibernate.type.internal.StandardBasicTypeImpl;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
import org.hibernate.usertype.UserType; import org.hibernate.usertype.UserType;
@ -32,7 +32,7 @@ public class BasicTypeRegistry implements Serializable {
private final TypeConfiguration typeConfiguration; private final TypeConfiguration typeConfiguration;
private final Map<SqlTypeDescriptor, Map<JavaTypeDescriptor<?>, BasicType<?>>> registryValues = new ConcurrentHashMap<>(); private final Map<JdbcTypeDescriptor, Map<JavaTypeDescriptor<?>, BasicType<?>>> registryValues = new ConcurrentHashMap<>();
private boolean primed; private boolean primed;
private final Map<String, BasicType<?>> typesByName = new ConcurrentHashMap<>(); private final Map<String, BasicType<?>> typesByName = new ConcurrentHashMap<>();
@ -61,7 +61,7 @@ public class BasicTypeRegistry implements Serializable {
* Find an existing BasicType registration for the given JavaTypeDescriptor and * Find an existing BasicType registration for the given JavaTypeDescriptor and
* SqlTypeDescriptor combo or create (and register) one. * SqlTypeDescriptor combo or create (and register) one.
*/ */
public <J> BasicType<J> resolve(JavaTypeDescriptor<J> jtdToUse, SqlTypeDescriptor stdToUse) { public <J> BasicType<J> resolve(JavaTypeDescriptor<J> jtdToUse, JdbcTypeDescriptor stdToUse) {
//noinspection unchecked //noinspection unchecked
return resolve( return resolve(
jtdToUse, jtdToUse,
@ -74,7 +74,7 @@ public class BasicTypeRegistry implements Serializable {
* Find an existing BasicType registration for the given JavaTypeDescriptor and * Find an existing BasicType registration for the given JavaTypeDescriptor and
* SqlTypeDescriptor combo or create (and register) one. * SqlTypeDescriptor combo or create (and register) one.
*/ */
public <J> BasicType<J> resolve(JavaTypeDescriptor<J> jtdToUse, SqlTypeDescriptor stdToUse, Supplier<BasicType<J>> creator) { public <J> BasicType<J> resolve(JavaTypeDescriptor<J> jtdToUse, JdbcTypeDescriptor stdToUse, Supplier<BasicType<J>> creator) {
final Map<JavaTypeDescriptor<?>, BasicType<?>> typeByJtdForStd = registryValues.computeIfAbsent( final Map<JavaTypeDescriptor<?>, BasicType<?>> typeByJtdForStd = registryValues.computeIfAbsent(
stdToUse, stdToUse,
sqlTypeDescriptor -> new ConcurrentHashMap<>() sqlTypeDescriptor -> new ConcurrentHashMap<>()
@ -118,7 +118,7 @@ public class BasicTypeRegistry implements Serializable {
private void applyOrOverwriteEntry(BasicType<?> type) { private void applyOrOverwriteEntry(BasicType<?> type) {
final Map<JavaTypeDescriptor<?>, BasicType<?>> mappingsForStdToUse = registryValues.computeIfAbsent( final Map<JavaTypeDescriptor<?>, BasicType<?>> mappingsForStdToUse = registryValues.computeIfAbsent(
type.getSqlTypeDescriptor(), type.getJdbcTypeDescriptor(),
sqlTypeDescriptor -> new ConcurrentHashMap<>() sqlTypeDescriptor -> new ConcurrentHashMap<>()
); );
@ -126,7 +126,7 @@ public class BasicTypeRegistry implements Serializable {
if ( existing != null ) { if ( existing != null ) {
LOG.debugf( LOG.debugf(
"BasicTypeRegistry registration overwritten (%s + %s); previous =`%s`", "BasicTypeRegistry registration overwritten (%s + %s); previous =`%s`",
type.getSqlTypeDescriptor().getFriendlyName(), type.getJdbcTypeDescriptor().getFriendlyName(),
type.getJavaTypeDescriptor(), type.getJavaTypeDescriptor(),
existing existing
); );
@ -184,7 +184,7 @@ public class BasicTypeRegistry implements Serializable {
private void primeRegistryEntry(BasicType<?> type) { private void primeRegistryEntry(BasicType<?> type) {
final Map<JavaTypeDescriptor<?>, BasicType<?>> mappingsForStdToUse = registryValues.computeIfAbsent( final Map<JavaTypeDescriptor<?>, BasicType<?>> mappingsForStdToUse = registryValues.computeIfAbsent(
type.getSqlTypeDescriptor(), type.getJdbcTypeDescriptor(),
sqlTypeDescriptor -> new ConcurrentHashMap<>() sqlTypeDescriptor -> new ConcurrentHashMap<>()
); );
@ -193,7 +193,7 @@ public class BasicTypeRegistry implements Serializable {
if ( existing != null ) { if ( existing != null ) {
LOG.debugf( LOG.debugf(
"Skipping registration of BasicType (%s + %s); still priming. existing = %s", "Skipping registration of BasicType (%s + %s); still priming. existing = %s",
type.getSqlTypeDescriptor().getFriendlyName(), type.getJdbcTypeDescriptor().getFriendlyName(),
type.getJavaTypeDescriptor(), type.getJavaTypeDescriptor(),
existing existing
); );

View File

@ -9,7 +9,7 @@ package org.hibernate.type;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.hibernate.type.descriptor.java.BigDecimalTypeDescriptor; import org.hibernate.type.descriptor.java.BigDecimalTypeDescriptor;
import org.hibernate.type.descriptor.sql.NumericTypeDescriptor; import org.hibernate.type.descriptor.jdbc.NumericTypeDescriptor;
/** /**
* A type that maps between a {@link java.sql.Types#NUMERIC NUMERIC} and {@link BigDecimal}. * A type that maps between a {@link java.sql.Types#NUMERIC NUMERIC} and {@link BigDecimal}.

View File

@ -10,7 +10,7 @@ import java.math.BigInteger;
import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Dialect;
import org.hibernate.type.descriptor.java.BigIntegerTypeDescriptor; import org.hibernate.type.descriptor.java.BigIntegerTypeDescriptor;
import org.hibernate.type.descriptor.sql.NumericTypeDescriptor; import org.hibernate.type.descriptor.jdbc.NumericTypeDescriptor;
/** /**
* A type that maps between a {@link java.sql.Types#NUMERIC NUMERIC} and {@link BigInteger}. * A type that maps between a {@link java.sql.Types#NUMERIC NUMERIC} and {@link BigInteger}.

View File

@ -10,7 +10,7 @@ import java.util.Comparator;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.type.descriptor.java.PrimitiveByteArrayTypeDescriptor; import org.hibernate.type.descriptor.java.PrimitiveByteArrayTypeDescriptor;
import org.hibernate.type.descriptor.sql.VarbinaryTypeDescriptor; import org.hibernate.type.descriptor.jdbc.VarbinaryTypeDescriptor;
/** /**
* A type that maps between a {@link java.sql.Types#VARBINARY VARBINARY} and {@code byte[]} * A type that maps between a {@link java.sql.Types#VARBINARY VARBINARY} and {@code byte[]}

View File

@ -21,7 +21,7 @@ public class BlobType extends AbstractSingleColumnStandardBasicType<Blob> {
public static final BlobType INSTANCE = new BlobType(); public static final BlobType INSTANCE = new BlobType();
public BlobType() { public BlobType() {
super( org.hibernate.type.descriptor.sql.BlobTypeDescriptor.DEFAULT, BlobTypeDescriptor.INSTANCE ); super( org.hibernate.type.descriptor.jdbc.BlobTypeDescriptor.DEFAULT, BlobTypeDescriptor.INSTANCE );
} }
@Override @Override

View File

@ -11,8 +11,8 @@ import java.sql.Types;
import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Dialect;
import org.hibernate.type.descriptor.java.BooleanTypeDescriptor; import org.hibernate.type.descriptor.java.BooleanTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
/** /**
* A type that maps between {@link java.sql.Types#BOOLEAN BOOLEAN} and {@link Boolean} * A type that maps between {@link java.sql.Types#BOOLEAN BOOLEAN} and {@link Boolean}
@ -26,11 +26,11 @@ public class BooleanType
public static final BooleanType INSTANCE = new BooleanType(); public static final BooleanType INSTANCE = new BooleanType();
public BooleanType() { public BooleanType() {
this( org.hibernate.type.descriptor.sql.BooleanTypeDescriptor.INSTANCE, BooleanTypeDescriptor.INSTANCE ); this( org.hibernate.type.descriptor.jdbc.BooleanTypeDescriptor.INSTANCE, BooleanTypeDescriptor.INSTANCE );
} }
protected BooleanType(SqlTypeDescriptor sqlTypeDescriptor, BooleanTypeDescriptor javaTypeDescriptor) { protected BooleanType(JdbcTypeDescriptor jdbcTypeDescriptor, BooleanTypeDescriptor javaTypeDescriptor) {
super( sqlTypeDescriptor, javaTypeDescriptor ); super( jdbcTypeDescriptor, javaTypeDescriptor );
} }
@Override @Override
public String getName() { public String getName() {
@ -60,25 +60,25 @@ public class BooleanType
} }
@Override @Override
public <X> BasicType<X> resolveIndicatedType(SqlTypeDescriptorIndicators indicators) { public <X> BasicType<X> resolveIndicatedType(JdbcTypeDescriptorIndicators indicators) {
final int preferredSqlTypeCodeForBoolean = indicators.getPreferredSqlTypeCodeForBoolean(); final int preferredSqlTypeCodeForBoolean = indicators.getPreferredSqlTypeCodeForBoolean();
final SqlTypeDescriptor sqlTypeDescriptor; final JdbcTypeDescriptor jdbcTypeDescriptor;
// We treat BIT like BOOLEAN because it uses the same JDBC access methods // We treat BIT like BOOLEAN because it uses the same JDBC access methods
if ( preferredSqlTypeCodeForBoolean != Types.BIT && preferredSqlTypeCodeForBoolean != getSqlTypeDescriptor().getJdbcTypeCode() ) { if ( preferredSqlTypeCodeForBoolean != Types.BIT && preferredSqlTypeCodeForBoolean != getJdbcTypeDescriptor().getJdbcTypeCode() ) {
sqlTypeDescriptor = indicators.getTypeConfiguration() jdbcTypeDescriptor = indicators.getTypeConfiguration()
.getSqlTypeDescriptorRegistry() .getJdbcTypeDescriptorRegistry()
.getDescriptor( preferredSqlTypeCodeForBoolean ); .getDescriptor( preferredSqlTypeCodeForBoolean );
} }
else { else {
sqlTypeDescriptor = indicators.getTypeConfiguration() jdbcTypeDescriptor = indicators.getTypeConfiguration()
.getSqlTypeDescriptorRegistry() .getJdbcTypeDescriptorRegistry()
.getDescriptor( Types.BOOLEAN ); .getDescriptor( Types.BOOLEAN );
} }
if ( sqlTypeDescriptor != getSqlTypeDescriptor() ) { if ( jdbcTypeDescriptor != getJdbcTypeDescriptor() ) {
//noinspection unchecked //noinspection unchecked
return (BasicType<X>) indicators.getTypeConfiguration() return (BasicType<X>) indicators.getTypeConfiguration()
.getBasicTypeRegistry() .getBasicTypeRegistry()
.resolve( getJavaTypeDescriptor(), sqlTypeDescriptor ); .resolve( getJavaTypeDescriptor(), jdbcTypeDescriptor );
} }
//noinspection unchecked //noinspection unchecked

View File

@ -12,7 +12,7 @@ import java.util.Comparator;
import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Dialect;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.type.descriptor.java.ByteTypeDescriptor; import org.hibernate.type.descriptor.java.ByteTypeDescriptor;
import org.hibernate.type.descriptor.sql.TinyIntTypeDescriptor; import org.hibernate.type.descriptor.jdbc.TinyIntTypeDescriptor;
/** /**
* A type that maps between {@link java.sql.Types#TINYINT TINYINT} and {@link Byte} * A type that maps between {@link java.sql.Types#TINYINT TINYINT} and {@link Byte}

View File

@ -13,7 +13,7 @@ import javax.persistence.TemporalType;
import org.hibernate.QueryException; import org.hibernate.QueryException;
import org.hibernate.metamodel.model.domain.AllowableTemporalParameterType; import org.hibernate.metamodel.model.domain.AllowableTemporalParameterType;
import org.hibernate.type.descriptor.java.CalendarDateTypeDescriptor; import org.hibernate.type.descriptor.java.CalendarDateTypeDescriptor;
import org.hibernate.type.descriptor.sql.DateTypeDescriptor; import org.hibernate.type.descriptor.jdbc.DateTypeDescriptor;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
/** /**

View File

@ -13,7 +13,7 @@ import javax.persistence.TemporalType;
import org.hibernate.QueryException; import org.hibernate.QueryException;
import org.hibernate.metamodel.model.domain.AllowableTemporalParameterType; import org.hibernate.metamodel.model.domain.AllowableTemporalParameterType;
import org.hibernate.type.descriptor.java.CalendarTimeTypeDescriptor; import org.hibernate.type.descriptor.java.CalendarTimeTypeDescriptor;
import org.hibernate.type.descriptor.sql.TimeTypeDescriptor; import org.hibernate.type.descriptor.jdbc.TimeTypeDescriptor;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
/** /**

View File

@ -16,7 +16,7 @@ import org.hibernate.QueryException;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.metamodel.model.domain.AllowableTemporalParameterType; import org.hibernate.metamodel.model.domain.AllowableTemporalParameterType;
import org.hibernate.type.descriptor.java.CalendarTypeDescriptor; import org.hibernate.type.descriptor.java.CalendarTypeDescriptor;
import org.hibernate.type.descriptor.sql.TimestampTypeDescriptor; import org.hibernate.type.descriptor.jdbc.TimestampTypeDescriptor;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
/** /**

View File

@ -8,9 +8,9 @@ package org.hibernate.type;
import java.sql.Types; import java.sql.Types;
import org.hibernate.type.descriptor.java.PrimitiveCharacterArrayTypeDescriptor; import org.hibernate.type.descriptor.java.PrimitiveCharacterArrayTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor; import org.hibernate.type.descriptor.jdbc.VarcharTypeDescriptor;
/** /**
* A type that maps between {@link java.sql.Types#VARCHAR VARCHAR} and {@code char[]} * A type that maps between {@link java.sql.Types#VARCHAR VARCHAR} and {@code char[]}
@ -37,15 +37,15 @@ public class CharArrayType
} }
@Override @Override
public <X> BasicType<X> resolveIndicatedType(SqlTypeDescriptorIndicators indicators) { public <X> BasicType<X> resolveIndicatedType(JdbcTypeDescriptorIndicators indicators) {
if ( indicators.isLob() ) { if ( indicators.isLob() ) {
//noinspection unchecked //noinspection unchecked
return (BasicType<X>) ( indicators.isNationalized() ? CharacterArrayNClobType.INSTANCE : CharacterArrayClobType.INSTANCE ); return (BasicType<X>) ( indicators.isNationalized() ? CharacterArrayNClobType.INSTANCE : CharacterArrayClobType.INSTANCE );
} }
if ( indicators.isNationalized() ) { if ( indicators.isNationalized() ) {
final SqlTypeDescriptor nvarcharType = indicators.getTypeConfiguration() final JdbcTypeDescriptor nvarcharType = indicators.getTypeConfiguration()
.getSqlTypeDescriptorRegistry() .getJdbcTypeDescriptorRegistry()
.getDescriptor( Types.NVARCHAR ); .getDescriptor( Types.NVARCHAR );
//noinspection unchecked //noinspection unchecked

View File

@ -7,8 +7,8 @@
package org.hibernate.type; package org.hibernate.type;
import org.hibernate.type.descriptor.java.CharacterArrayTypeDescriptor; import org.hibernate.type.descriptor.java.CharacterArrayTypeDescriptor;
import org.hibernate.type.descriptor.sql.ClobTypeDescriptor; import org.hibernate.type.descriptor.jdbc.ClobTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
/** /**
* A type that maps between {@link java.sql.Types#CLOB CLOB} and {@link Character Character[]} * A type that maps between {@link java.sql.Types#CLOB CLOB} and {@link Character Character[]}
@ -33,7 +33,7 @@ public class CharacterArrayClobType
} }
@Override @Override
public <X> BasicType<X> resolveIndicatedType(SqlTypeDescriptorIndicators indicators) { public <X> BasicType<X> resolveIndicatedType(JdbcTypeDescriptorIndicators indicators) {
//noinspection unchecked //noinspection unchecked
return (BasicType<X>) ( indicators.isNationalized() ? CharacterArrayNClobType.INSTANCE : this ); return (BasicType<X>) ( indicators.isNationalized() ? CharacterArrayNClobType.INSTANCE : this );
} }

View File

@ -7,7 +7,7 @@
package org.hibernate.type; package org.hibernate.type;
import org.hibernate.type.descriptor.java.CharacterArrayTypeDescriptor; import org.hibernate.type.descriptor.java.CharacterArrayTypeDescriptor;
import org.hibernate.type.descriptor.sql.NClobTypeDescriptor; import org.hibernate.type.descriptor.jdbc.NClobTypeDescriptor;
/** /**
* A type that maps between {@link java.sql.Types#NCLOB NCLOB} and {@link Character Character[]} * A type that maps between {@link java.sql.Types#NCLOB NCLOB} and {@link Character Character[]}

View File

@ -8,9 +8,9 @@ package org.hibernate.type;
import java.sql.Types; import java.sql.Types;
import org.hibernate.type.descriptor.java.CharacterArrayTypeDescriptor; import org.hibernate.type.descriptor.java.CharacterArrayTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor; import org.hibernate.type.descriptor.jdbc.VarcharTypeDescriptor;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
/** /**
@ -38,7 +38,7 @@ public class CharacterArrayType
} }
@Override @Override
public <X> BasicType<X> resolveIndicatedType(SqlTypeDescriptorIndicators indicators) { public <X> BasicType<X> resolveIndicatedType(JdbcTypeDescriptorIndicators indicators) {
if ( indicators.isNationalized() ) { if ( indicators.isNationalized() ) {
final TypeConfiguration typeConfiguration = indicators.getTypeConfiguration(); final TypeConfiguration typeConfiguration = indicators.getTypeConfiguration();
if ( indicators.isLob() ) { if ( indicators.isLob() ) {
@ -46,7 +46,7 @@ public class CharacterArrayType
return (BasicType<X>) CharacterArrayNClobType.INSTANCE; return (BasicType<X>) CharacterArrayNClobType.INSTANCE;
} }
else { else {
final SqlTypeDescriptor nvarcharType = typeConfiguration.getSqlTypeDescriptorRegistry().getDescriptor( Types.NVARCHAR ); final JdbcTypeDescriptor nvarcharType = typeConfiguration.getJdbcTypeDescriptorRegistry().getDescriptor( Types.NVARCHAR );
//noinspection unchecked //noinspection unchecked
return (BasicType<X>) typeConfiguration.getBasicTypeRegistry().resolve( getJavaTypeDescriptor(), nvarcharType ); return (BasicType<X>) typeConfiguration.getBasicTypeRegistry().resolve( getJavaTypeDescriptor(), nvarcharType );
} }

View File

@ -10,7 +10,7 @@ import java.io.Serializable;
import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Dialect;
import org.hibernate.type.descriptor.java.CharacterTypeDescriptor; import org.hibernate.type.descriptor.java.CharacterTypeDescriptor;
import org.hibernate.type.descriptor.sql.NCharTypeDescriptor; import org.hibernate.type.descriptor.jdbc.NCharTypeDescriptor;
/** /**
* A type that maps between {@link java.sql.Types#NCHAR NCHAR(1)} and {@link Character} * A type that maps between {@link java.sql.Types#NCHAR NCHAR(1)} and {@link Character}

View File

@ -10,8 +10,8 @@ import java.io.Serializable;
import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Dialect;
import org.hibernate.type.descriptor.java.CharacterTypeDescriptor; import org.hibernate.type.descriptor.java.CharacterTypeDescriptor;
import org.hibernate.type.descriptor.sql.CharTypeDescriptor; import org.hibernate.type.descriptor.jdbc.CharTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
/** /**
* A type that maps between {@link java.sql.Types#CHAR CHAR(1)} and {@link Character} * A type that maps between {@link java.sql.Types#CHAR CHAR(1)} and {@link Character}
@ -55,7 +55,7 @@ public class CharacterType
} }
@Override @Override
public <X> BasicType<X> resolveIndicatedType(SqlTypeDescriptorIndicators indicators) { public <X> BasicType<X> resolveIndicatedType(JdbcTypeDescriptorIndicators indicators) {
return (BasicType<X>) ( indicators.isNationalized() ? CharacterNCharType.INSTANCE : this ); return (BasicType<X>) ( indicators.isNationalized() ? CharacterNCharType.INSTANCE : this );
} }
} }

View File

@ -6,7 +6,7 @@
*/ */
package org.hibernate.type; package org.hibernate.type;
import org.hibernate.type.descriptor.java.ClassTypeDescriptor; import org.hibernate.type.descriptor.java.ClassTypeDescriptor;
import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor; import org.hibernate.type.descriptor.jdbc.VarcharTypeDescriptor;
/** /**
* A type that maps between {@link java.sql.Types#VARCHAR VARCHAR} and {@link Class} * A type that maps between {@link java.sql.Types#VARCHAR VARCHAR} and {@link Class}

View File

@ -10,7 +10,7 @@ import java.sql.Clob;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.type.descriptor.java.ClobTypeDescriptor; import org.hibernate.type.descriptor.java.ClobTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
/** /**
* A type that maps between {@link java.sql.Types#CLOB CLOB} and {@link Clob} * A type that maps between {@link java.sql.Types#CLOB CLOB} and {@link Clob}
@ -22,7 +22,7 @@ public class ClobType extends AbstractSingleColumnStandardBasicType<Clob> implem
public static final ClobType INSTANCE = new ClobType(); public static final ClobType INSTANCE = new ClobType();
public ClobType() { public ClobType() {
super( org.hibernate.type.descriptor.sql.ClobTypeDescriptor.DEFAULT, ClobTypeDescriptor.INSTANCE ); super( org.hibernate.type.descriptor.jdbc.ClobTypeDescriptor.DEFAULT, ClobTypeDescriptor.INSTANCE );
} }
@Override @Override
@ -42,7 +42,7 @@ public class ClobType extends AbstractSingleColumnStandardBasicType<Clob> implem
@SuppressWarnings({"rawtypes", "unchecked"}) @SuppressWarnings({"rawtypes", "unchecked"})
@Override @Override
public BasicType resolveIndicatedType(SqlTypeDescriptorIndicators indicators) { public BasicType resolveIndicatedType(JdbcTypeDescriptorIndicators indicators) {
// todo (6.0) : Support a "wrapped clob"? This would be a (N)VARCHAR column we handle as a Clob in-memory // todo (6.0) : Support a "wrapped clob"? This would be a (N)VARCHAR column we handle as a Clob in-memory
// - might be especially interesting for streaming based (N)VARCHAR reading // - might be especially interesting for streaming based (N)VARCHAR reading

View File

@ -34,7 +34,7 @@ import org.hibernate.tuple.ValueGeneration;
import org.hibernate.tuple.component.ComponentMetamodel; import org.hibernate.tuple.component.ComponentMetamodel;
import org.hibernate.tuple.component.ComponentTuplizer; import org.hibernate.tuple.component.ComponentTuplizer;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
/** /**
@ -760,7 +760,7 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
} }
@Override @Override
public SqlTypeDescriptor getSqlTypeDescriptor() { public JdbcTypeDescriptor getJdbcTypeDescriptor() {
throw new NotYetImplementedFor6Exception( getClass() ); throw new NotYetImplementedFor6Exception( getClass() );
} }

View File

@ -10,7 +10,7 @@ import java.util.Currency;
import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Dialect;
import org.hibernate.type.descriptor.java.CurrencyTypeDescriptor; import org.hibernate.type.descriptor.java.CurrencyTypeDescriptor;
import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor; import org.hibernate.type.descriptor.jdbc.VarcharTypeDescriptor;
/** /**
* A type that maps between {@link java.sql.Types#VARCHAR VARCHAR} and {@link Currency} * A type that maps between {@link java.sql.Types#VARCHAR VARCHAR} and {@link Currency}

View File

@ -24,7 +24,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.internal.util.collections.ArrayHelper; import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
import org.hibernate.usertype.EnhancedUserType; import org.hibernate.usertype.EnhancedUserType;
import org.hibernate.usertype.LoggableUserType; import org.hibernate.usertype.LoggableUserType;
@ -56,7 +56,7 @@ public class CustomType
private final String name; private final String name;
private final JavaTypeDescriptor mappedJavaTypeDescriptor; private final JavaTypeDescriptor mappedJavaTypeDescriptor;
private final SqlTypeDescriptor sqlTypeDescriptor; private final JdbcTypeDescriptor jdbcTypeDescriptor;
private final Size dictatedSize; private final Size dictatedSize;
private final Size defaultSize; private final Size defaultSize;
@ -73,7 +73,7 @@ public class CustomType
//noinspection unchecked //noinspection unchecked
this.mappedJavaTypeDescriptor = typeConfiguration.getJavaTypeDescriptorRegistry().getDescriptor( userType.returnedClass() ); this.mappedJavaTypeDescriptor = typeConfiguration.getJavaTypeDescriptorRegistry().getDescriptor( userType.returnedClass() );
this.sqlTypeDescriptor = typeConfiguration.getSqlTypeDescriptorRegistry().getDescriptor( userType.sqlTypes()[0] ); this.jdbcTypeDescriptor = typeConfiguration.getJdbcTypeDescriptorRegistry().getDescriptor( userType.sqlTypes()[0] );
if ( userType instanceof Sized ) { if ( userType instanceof Sized ) {
final Sized sized = (Sized) userType; final Sized sized = (Sized) userType;
@ -94,13 +94,13 @@ public class CustomType
} }
@Override @Override
public SqlTypeDescriptor getSqlTypeDescriptor() { public JdbcTypeDescriptor getJdbcTypeDescriptor() {
return sqlTypeDescriptor; return jdbcTypeDescriptor;
} }
@Override @Override
public int[] sqlTypes(Mapping pi) { public int[] sqlTypes(Mapping pi) {
return new int[] { sqlTypeDescriptor.getSqlType() }; return new int[] { jdbcTypeDescriptor.getJdbcType() };
} }
@Override @Override

View File

@ -29,7 +29,7 @@ public class DateType
public static final DateType INSTANCE = new DateType(); public static final DateType INSTANCE = new DateType();
public DateType() { public DateType() {
super( org.hibernate.type.descriptor.sql.DateTypeDescriptor.INSTANCE, JdbcDateTypeDescriptor.INSTANCE ); super( org.hibernate.type.descriptor.jdbc.DateTypeDescriptor.INSTANCE, JdbcDateTypeDescriptor.INSTANCE );
} }
public String getName() { public String getName() {

View File

@ -23,7 +23,7 @@ public class DoubleType extends AbstractSingleColumnStandardBasicType<Double> im
public static final Double ZERO = 0.0; public static final Double ZERO = 0.0;
public DoubleType() { public DoubleType() {
super( org.hibernate.type.descriptor.sql.FloatTypeDescriptor.INSTANCE, DoubleTypeDescriptor.INSTANCE ); super( org.hibernate.type.descriptor.jdbc.FloatTypeDescriptor.INSTANCE, DoubleTypeDescriptor.INSTANCE );
} }
@Override @Override
public String getName() { public String getName() {

Some files were not shown because too many files have changed in this diff Show More