HHH-14524 : Rename SqlType(X) as JdbcType(X)
This commit is contained in:
parent
a02835bdde
commit
7fcde66d61
|
@ -7,9 +7,9 @@ Changes in 6.0 worth documenting in various places
|
|||
|
||||
Document in release-notes:
|
||||
|
||||
* `@SqlTypeCode`
|
||||
* `@SqlType`
|
||||
* `@SqlTypeRegistration`
|
||||
* `@JdbcTypeCode`
|
||||
* `@JdbcType`
|
||||
* `@JdbcTypeRegistration`
|
||||
* `@JavaType`
|
||||
* `@JavaTypeRegistration`
|
||||
* `NativeQuery#addScalar(Class)`
|
||||
|
|
|
@ -68,7 +68,7 @@ troubleshooting device. Some log categories of particular interest include:
|
|||
|org.hibernate.SQL
|
||||
|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
|
||||
|
||||
|org.hibernate.tool.hbm2ddl
|
||||
|
|
|
@ -36,7 +36,7 @@ log4j.logger.org.hibernate.SQL=debug
|
|||
|
||||
### log JDBC bind parameters ###
|
||||
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.
|
||||
|
|
|
@ -276,8 +276,8 @@ include::{sourcedir}/basic/BitSetType.java[tags=basic-custom-type-BitSetType-exa
|
|||
----
|
||||
====
|
||||
|
||||
The `AbstractSingleColumnStandardBasicType` requires an `sqlTypeDescriptor` and a `javaTypeDescriptor`.
|
||||
The `sqlTypeDescriptor` is `VarcharTypeDescriptor.INSTANCE` because the database column is a VARCHAR.
|
||||
The `AbstractSingleColumnStandardBasicType` requires an `jdbcTypeDescriptor` and a `javaTypeDescriptor`.
|
||||
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:
|
||||
|
||||
[[basic-custom-type-BitSetTypeDescriptor-example]]
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
=== JDBC Mappings
|
||||
|
||||
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
|
||||
the `JavaTypeDescriptor` and `SqlTypeDescriptor` independently. Under this new approach, the resolution of a
|
||||
(`JavaTypeDescriptor`) and a SQL/JDBC type (`JdbcTypeDescriptor`). 6.0 introduces the ability to influence
|
||||
the `JavaTypeDescriptor` and `JdbcTypeDescriptor` independently. Under this new approach, the resolution of a
|
||||
basic value mapping comes down to:
|
||||
|
||||
* `JavaTypeDescriptor` to use
|
||||
* `SqlTypeDescriptor` to use
|
||||
* `JdbcTypeDescriptor` to use
|
||||
* `BasicValueConverter` to use (if one)
|
||||
* `MutabilityPlan` to use
|
||||
|
||||
|
@ -29,13 +29,13 @@ An `AttributeConverter` can also influence the `JavaTypeDescriptor` used in cert
|
|||
|
||||
==== 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
|
||||
be used to register a `SqlTypeDescriptor` with the `SqlTypeDescriptorRegistry`.
|
||||
`JdbcTypeCode` can be used to indicate the `JdbcTypeDescriptorRegistry` entry to use. `JdbcTypeRegistration` can
|
||||
be used to register a `JdbcTypeDescriptor` with the `JdbcTypeDescriptorRegistry`.
|
||||
|
||||
`@MapKeySqlType` and `@MapKeySqlTypeCode` work the same as `@SqlType` and `@SqlTypeCode`, respectively, except
|
||||
describing the `SqlTypeDescriptor` to use for the map's key. In which case, `@SqlType` and `@SqlTypeCode` refer
|
||||
`MapKeyJdbcType` and `MapKeyJdbcTypeCode` work the same as `JdbcType` and `JdbcTypeCode`, respectively, except
|
||||
describing the `JdbcTypeDescriptor` to use for the map's key. In which case, `JdbcType` and `JdbcTypeCode` refer
|
||||
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
|
||||
|
@ -44,12 +44,12 @@ 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
|
||||
|
||||
`@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.
|
||||
|
||||
`@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"
|
||||
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ package org.hibernate.userguide.collections.type;
|
|||
import java.util.List;
|
||||
|
||||
import org.hibernate.type.AbstractSingleColumnStandardBasicType;
|
||||
import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.VarcharTypeDescriptor;
|
||||
|
||||
/**
|
||||
* @author Vlad Mihalcea
|
||||
|
|
|
@ -11,14 +11,12 @@ import java.util.Comparator;
|
|||
import java.util.Date;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.type.AbstractSingleColumnStandardBasicType;
|
||||
import org.hibernate.type.LiteralType;
|
||||
import org.hibernate.type.StringType;
|
||||
import org.hibernate.type.VersionType;
|
||||
import org.hibernate.type.descriptor.java.JdbcTimestampTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.BigIntTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.BigIntTypeDescriptor;
|
||||
|
||||
/**
|
||||
* @author Vlad Mihalcea
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.BitSet;
|
|||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.type.AbstractSingleColumnStandardBasicType;
|
||||
import org.hibernate.type.DiscriminatorType;
|
||||
import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.VarcharTypeDescriptor;
|
||||
|
||||
/**
|
||||
* @author Vlad Mihalcea
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.hibernate.userguide.mapping.basic;
|
||||
|
||||
import org.hibernate.type.AbstractSingleColumnStandardBasicType;
|
||||
import org.hibernate.type.descriptor.sql.CharTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.CharTypeDescriptor;
|
||||
|
||||
/**
|
||||
* @author Vlad Mihalcea
|
||||
|
|
|
@ -26,7 +26,7 @@ log4j.logger.org.hibernate.SQL=debug
|
|||
|
||||
### log JDBC bind parameters ###
|
||||
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.IdentifierGeneratorHelper=trace
|
||||
log4j.logger.org.hibernate.persister.entity.AbstractEntityPersister=trace
|
||||
|
|
|
@ -34,8 +34,8 @@ log4j.logger.org.hibernate.testing.cache=debug
|
|||
# SQL Logging - HHH-6833
|
||||
log4j.logger.org.hibernate.SQL=debug
|
||||
|
||||
log4j.logger.org.hibernate.type.descriptor.sql.BasicBinder=trace
|
||||
log4j.logger.org.hibernate.type.descriptor.sql.BasicExtractor=trace
|
||||
log4j.logger.org.hibernate.type.descriptor.jdbc.BasicBinder=trace
|
||||
log4j.logger.org.hibernate.type.descriptor.jdbc.BasicExtractor=trace
|
||||
|
||||
log4j.logger.org.hibernate.hql.internal.ast=debug
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ import java.lang.annotation.Inherited;
|
|||
import java.lang.annotation.Retention;
|
||||
|
||||
import org.hibernate.resource.beans.spi.ManagedBean;
|
||||
import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
|
||||
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.FIELD;
|
||||
|
@ -19,26 +19,25 @@ import static java.lang.annotation.ElementType.METHOD;
|
|||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
/**
|
||||
* Allows specifying the specific {@link org.hibernate.type.descriptor.sql.SqlTypeDescriptor}
|
||||
* to use for a particular column mapping. Can reference a {@link ManagedBean} - see
|
||||
* {@link ManagedBeanRegistry}
|
||||
* Allows specifying the specific {@link JdbcTypeDescriptor}
|
||||
* to use for a particular column mapping. Resolved as a {@link ManagedBean}
|
||||
*
|
||||
* ````
|
||||
* @Entity
|
||||
* class User {
|
||||
* ...
|
||||
* @SqlType ( MyCustomSqlIntegerDescriptor.class )
|
||||
* @JdbcType ( MyCustomSqlIntegerDescriptor.class )
|
||||
* int getAge() { ... }
|
||||
*
|
||||
* @SqlType ( MyCustomSqlVarcharDescriptor.class )
|
||||
* @JdbcType ( MyCustomSqlVarcharDescriptor.class )
|
||||
* 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 org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry
|
||||
* @see JdbcTypeDescriptor
|
||||
* @see JdbcTypeDescriptorRegistry
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*
|
||||
|
@ -47,6 +46,6 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||
@java.lang.annotation.Target({METHOD, FIELD, ANNOTATION_TYPE})
|
||||
@Inherited
|
||||
@Retention(RUNTIME)
|
||||
public @interface SqlType {
|
||||
Class<? extends SqlTypeDescriptor> value();
|
||||
public @interface JdbcType {
|
||||
Class<? extends JdbcTypeDescriptor> value();
|
||||
}
|
|
@ -9,6 +9,9 @@ package org.hibernate.annotations;
|
|||
import java.lang.annotation.Inherited;
|
||||
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.FIELD;
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
|
@ -17,10 +20,10 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||
/**
|
||||
* @asciidoc
|
||||
*
|
||||
* Allows specifying the {@link org.hibernate.type.descriptor.sql.SqlTypeDescriptor} to
|
||||
* use based on the type-code. This might be a* standard {@linkplain java.sql.Types JDBC Types}
|
||||
* Allows specifying the {@link JdbcTypeDescriptor} to
|
||||
* 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
|
||||
* {@link org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry} registered under this code
|
||||
* {@link JdbcTypeDescriptorRegistry} registered under this code
|
||||
*
|
||||
* ````
|
||||
* @Entity
|
||||
|
@ -28,29 +31,29 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||
* ...
|
||||
* // By default Hibernate maps Java's Integer to JDBC's INTEGER
|
||||
* // but here we want to use JDBC's TINYINT instead.
|
||||
* @SqlTypeCode ( Types.TINYINT )
|
||||
* @JdbcTypeCode ( Types.TINYINT )
|
||||
* int getAge() { ... }
|
||||
*
|
||||
* // By default Hibernate maps Java's String to JDBC's VARCHAR
|
||||
* // but here we want to use JDBC's NVARCHAR instead.
|
||||
* @SqlTypeCode ( Types.NVARCHAR )
|
||||
* @JdbcTypeCode ( Types.NVARCHAR )
|
||||
* String getName() { ... }
|
||||
* }
|
||||
* ````
|
||||
* *
|
||||
*
|
||||
* Other forms of influencing the JDBC type used include:<ul>
|
||||
* <li>{@link javax.persistence.Enumerated} / {@link javax.persistence.EnumType}</li>
|
||||
* <li>{@link javax.persistence.TemporalType}</li>
|
||||
* <li>{@link javax.persistence.Lob}</li>
|
||||
* <li>{@link Nationalized}</li>
|
||||
* <li>{@link SqlType}</li>
|
||||
* <li>{@link JdbcType}</li>
|
||||
* </ul>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
|
@ -59,10 +62,10 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||
@java.lang.annotation.Target({METHOD, FIELD, ANNOTATION_TYPE})
|
||||
@Inherited
|
||||
@Retention(RUNTIME)
|
||||
public @interface SqlTypeCode {
|
||||
public @interface JdbcTypeCode {
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
int value();
|
|
@ -10,7 +10,8 @@ import java.lang.annotation.Inherited;
|
|||
import java.lang.annotation.Repeatable;
|
||||
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.PACKAGE;
|
||||
|
@ -19,7 +20,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||
|
||||
/**
|
||||
* Describes a SqlTypeDescriptor to be added to the
|
||||
* {@link org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry}
|
||||
* {@link JdbcTypeDescriptorRegistry}
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*
|
||||
|
@ -28,18 +29,18 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||
@java.lang.annotation.Target({PACKAGE, TYPE, ANNOTATION_TYPE})
|
||||
@Inherited
|
||||
@Retention(RUNTIME)
|
||||
@Repeatable( SqlTypeRegistrations.class )
|
||||
public @interface SqlTypeRegistration {
|
||||
@Repeatable( JdbcTypeRegistrations.class )
|
||||
public @interface JdbcTypeRegistration {
|
||||
/**
|
||||
* 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
|
||||
* 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;
|
||||
}
|
|
@ -15,7 +15,7 @@ import static java.lang.annotation.ElementType.TYPE;
|
|||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
/**
|
||||
* Grouping of {@link SqlTypeRegistration}
|
||||
* Grouping of {@link JdbcTypeRegistration}
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*
|
||||
|
@ -24,6 +24,6 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||
@java.lang.annotation.Target({PACKAGE, TYPE, ANNOTATION_TYPE})
|
||||
@Inherited
|
||||
@Retention(RUNTIME)
|
||||
public @interface SqlTypeRegistrations {
|
||||
SqlTypeRegistration[] value();
|
||||
public @interface JdbcTypeRegistrations {
|
||||
JdbcTypeRegistration[] value();
|
||||
}
|
|
@ -15,7 +15,7 @@ import static java.lang.annotation.ElementType.METHOD;
|
|||
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
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
|
@ -25,6 +25,6 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||
@java.lang.annotation.Target({METHOD, FIELD, ANNOTATION_TYPE})
|
||||
@Inherited
|
||||
@Retention(RUNTIME)
|
||||
public @interface MapKeySqlType {
|
||||
SqlType value();
|
||||
public @interface MapKeyJdbcType {
|
||||
JdbcType value();
|
||||
}
|
|
@ -15,7 +15,7 @@ import static java.lang.annotation.ElementType.METHOD;
|
|||
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
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
|
@ -25,6 +25,6 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||
@java.lang.annotation.Target({METHOD, FIELD, ANNOTATION_TYPE})
|
||||
@Inherited
|
||||
@Retention(RUNTIME)
|
||||
public @interface MapKeySqlTypeCode {
|
||||
SqlTypeCode value();
|
||||
public @interface MapKeyJdbcTypeCode {
|
||||
JdbcTypeCode value();
|
||||
}
|
|
@ -107,7 +107,7 @@ import org.hibernate.mapping.UniqueKey;
|
|||
import org.hibernate.query.named.NamedObjectRepository;
|
||||
import org.hibernate.query.sqm.function.SqmFunctionDescriptor;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -397,8 +397,8 @@ public class InFlightMetadataCollectorImpl implements InFlightMetadataCollector
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addSqlTypeRegistration(int typeCode, SqlTypeDescriptor std) {
|
||||
getTypeConfiguration().getSqlTypeDescriptorRegistry().addDescriptor( typeCode, std );
|
||||
public void addJdbcTypeRegistration(int typeCode, JdbcTypeDescriptor jdbcTypeDescriptor) {
|
||||
getTypeConfiguration().getJdbcTypeDescriptorRegistry().addDescriptor( typeCode, jdbcTypeDescriptor );
|
||||
}
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -68,7 +68,7 @@ import org.hibernate.query.sqm.function.SqmFunctionDescriptor;
|
|||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.type.BasicType;
|
||||
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.usertype.UserType;
|
||||
|
||||
|
@ -283,8 +283,8 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont
|
|||
}
|
||||
|
||||
@Override
|
||||
public void contributeSqlTypeDescriptor(SqlTypeDescriptor descriptor) {
|
||||
this.bootstrapContext.getTypeConfiguration().getSqlTypeDescriptorRegistry().addDescriptor( descriptor );
|
||||
public void contributeJdbcTypeDescriptor(JdbcTypeDescriptor descriptor) {
|
||||
this.bootstrapContext.getTypeConfiguration().getJdbcTypeDescriptorRegistry().addDescriptor( descriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,7 +9,7 @@ package org.hibernate.boot.model;
|
|||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.StandardBasicTypeTemplate;
|
||||
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.spi.TypeConfiguration;
|
||||
import org.hibernate.usertype.UserType;
|
||||
|
@ -32,17 +32,17 @@ public interface TypeContributions {
|
|||
* Add the JavaTypeDescriptor to the {@link TypeConfiguration}'s
|
||||
* {@link JavaTypeDescriptorRegistry}
|
||||
*/
|
||||
void contributeSqlTypeDescriptor(SqlTypeDescriptor descriptor);
|
||||
void contributeJdbcTypeDescriptor(JdbcTypeDescriptor descriptor);
|
||||
|
||||
void contributeType(BasicType type);
|
||||
|
||||
/**
|
||||
* @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
|
||||
* 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
|
||||
* 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
|
||||
* 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.
|
||||
* 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
|
||||
* existing {@link JavaTypeDescriptor} and {@link SqlTypeDescriptor}
|
||||
* existing {@link JavaTypeDescriptor} and {@link JdbcTypeDescriptor}
|
||||
* implementations (or write your own for custom impls) and use
|
||||
* {@link StandardBasicTypeTemplate} to combine those with registration keys
|
||||
* and call {@link #contributeType(BasicType)} instead
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.hibernate.type.Type;
|
|||
import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
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.spi.TypeConfiguration;
|
||||
import org.hibernate.type.spi.TypeConfigurationAware;
|
||||
|
@ -212,8 +212,8 @@ public class TypeDefinition implements Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor getRelationalSqlTypeDescriptor() {
|
||||
return resolvedBasicType.getSqlTypeDescriptor();
|
||||
public JdbcTypeDescriptor getJdbcTypeDescriptor() {
|
||||
return resolvedBasicType.getJdbcTypeDescriptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -264,8 +264,8 @@ public class TypeDefinition implements Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor getRelationalSqlTypeDescriptor() {
|
||||
return resolved.getSqlTypeDescriptor();
|
||||
public JdbcTypeDescriptor getJdbcTypeDescriptor() {
|
||||
return resolved.getJdbcTypeDescriptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -14,7 +14,7 @@ import org.hibernate.type.CustomType;
|
|||
import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
|
@ -23,19 +23,19 @@ public class EnumeratedValueResolution<E extends Enum<E>> implements BasicValue.
|
|||
private final CustomType enumTypeMapping;
|
||||
private final JavaTypeDescriptor<E> domainJtd;
|
||||
private final JavaTypeDescriptor<?> jdbcJtd;
|
||||
private final SqlTypeDescriptor std;
|
||||
private final JdbcTypeDescriptor jdbcTypeDescriptor;
|
||||
private final EnumValueConverter<E,?> valueConverter;
|
||||
|
||||
public EnumeratedValueResolution(
|
||||
CustomType enumTypeMapping,
|
||||
JavaTypeDescriptor<E> domainJtd,
|
||||
JavaTypeDescriptor<?> jdbcJtd,
|
||||
SqlTypeDescriptor std,
|
||||
JdbcTypeDescriptor jdbcTypeDescriptor,
|
||||
EnumValueConverter<E, ?> valueConverter) {
|
||||
this.enumTypeMapping = enumTypeMapping;
|
||||
this.domainJtd = domainJtd;
|
||||
this.jdbcJtd = jdbcJtd;
|
||||
this.std = std;
|
||||
this.jdbcTypeDescriptor = jdbcTypeDescriptor;
|
||||
this.valueConverter = valueConverter;
|
||||
}
|
||||
|
||||
|
@ -60,8 +60,8 @@ public class EnumeratedValueResolution<E extends Enum<E>> implements BasicValue.
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor getRelationalSqlTypeDescriptor() {
|
||||
return std;
|
||||
public JdbcTypeDescriptor getJdbcTypeDescriptor() {
|
||||
return jdbcTypeDescriptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.hibernate.metamodel.model.convert.spi.BasicValueConverter;
|
|||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
|
@ -20,7 +20,7 @@ import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
|||
public class InferredBasicValueResolution<J> implements BasicValue.Resolution<J> {
|
||||
private JavaTypeDescriptor<J> domainJtd;
|
||||
private JavaTypeDescriptor<J> relationalJtd;
|
||||
private SqlTypeDescriptor relationalStd;
|
||||
private JdbcTypeDescriptor jdbcTypeDescriptor;
|
||||
|
||||
private MutabilityPlan mutabilityPlan;
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class InferredBasicValueResolution<J> implements BasicValue.Resolution<J>
|
|||
JdbcMapping jdbcMapping,
|
||||
JavaTypeDescriptor<J> domainJtd,
|
||||
JavaTypeDescriptor<J> relationalJtd,
|
||||
SqlTypeDescriptor relationalStd,
|
||||
JdbcTypeDescriptor jdbcTypeDescriptor,
|
||||
BasicValueConverter valueConverter,
|
||||
BasicType<J> legacyType,
|
||||
MutabilityPlan mutabilityPlan) {
|
||||
|
@ -41,7 +41,7 @@ public class InferredBasicValueResolution<J> implements BasicValue.Resolution<J>
|
|||
this.legacyType = legacyType;
|
||||
this.domainJtd = domainJtd;
|
||||
this.relationalJtd = relationalJtd;
|
||||
this.relationalStd = relationalStd;
|
||||
this.jdbcTypeDescriptor = jdbcTypeDescriptor;
|
||||
this.valueConverter = valueConverter;
|
||||
this.mutabilityPlan = mutabilityPlan == null ? domainJtd.getMutabilityPlan() : mutabilityPlan;
|
||||
}
|
||||
|
@ -67,8 +67,8 @@ public class InferredBasicValueResolution<J> implements BasicValue.Resolution<J>
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor getRelationalSqlTypeDescriptor() {
|
||||
return relationalStd;
|
||||
public JdbcTypeDescriptor getJdbcTypeDescriptor() {
|
||||
return jdbcTypeDescriptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,9 +27,9 @@ import org.hibernate.type.descriptor.java.EnumJavaTypeDescriptor;
|
|||
import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.TemporalJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.sql.TinyIntTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.jdbc.TinyIntTypeDescriptor;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
/**
|
||||
|
@ -42,9 +42,9 @@ public class InferredBasicValueResolver {
|
|||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public static BasicValue.Resolution from(
|
||||
Function<TypeConfiguration, BasicJavaDescriptor> explicitJavaTypeAccess,
|
||||
Function<TypeConfiguration, SqlTypeDescriptor> explicitSqlTypeAccess,
|
||||
Function<TypeConfiguration, JdbcTypeDescriptor> explicitSqlTypeAccess,
|
||||
Supplier<JavaTypeDescriptor> reflectedJtdResolver,
|
||||
SqlTypeDescriptorIndicators stdIndicators,
|
||||
JdbcTypeDescriptorIndicators stdIndicators,
|
||||
Table table,
|
||||
Selectable selectable,
|
||||
String ownerName,
|
||||
|
@ -52,7 +52,7 @@ public class InferredBasicValueResolver {
|
|||
TypeConfiguration typeConfiguration) {
|
||||
|
||||
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();
|
||||
|
||||
|
@ -66,20 +66,20 @@ public class InferredBasicValueResolver {
|
|||
if ( explicitJavaType != null ) {
|
||||
// we have an explicit @JavaType
|
||||
|
||||
if ( explicitSqlType != null ) {
|
||||
if ( explicitJdbcType != null ) {
|
||||
// we also have an explicit @SqlType(Code)
|
||||
|
||||
jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve(
|
||||
explicitJavaType,
|
||||
explicitSqlType
|
||||
explicitJdbcType
|
||||
);
|
||||
}
|
||||
else {
|
||||
// infer the STD
|
||||
final SqlTypeDescriptor inferredStd = explicitJavaType.getJdbcRecommendedSqlType( stdIndicators );
|
||||
final JdbcTypeDescriptor inferredJdbcType = explicitJavaType.getRecommendedJdbcType( stdIndicators );
|
||||
jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve(
|
||||
explicitJavaType,
|
||||
inferredStd
|
||||
inferredJdbcType
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -88,12 +88,12 @@ public class InferredBasicValueResolver {
|
|||
else if ( reflectedJtd != null ) {
|
||||
// we were able to determine the "reflected java-type"
|
||||
|
||||
if ( explicitSqlType != null ) {
|
||||
if ( explicitJdbcType != null ) {
|
||||
// we also have an explicit @SqlType(Code)
|
||||
|
||||
jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve(
|
||||
reflectedJtd,
|
||||
explicitSqlType
|
||||
explicitJdbcType
|
||||
);
|
||||
|
||||
legacyType = jdbcMapping;
|
||||
|
@ -109,13 +109,13 @@ public class InferredBasicValueResolver {
|
|||
}
|
||||
}
|
||||
else {
|
||||
if ( explicitSqlType != null ) {
|
||||
if ( explicitJdbcType != null ) {
|
||||
// we have an explicit STD, but no JTD - infer JTD
|
||||
// - 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(
|
||||
recommendedJtd,
|
||||
explicitSqlType
|
||||
explicitJdbcType
|
||||
);
|
||||
|
||||
jdbcMapping = resolveSqlTypeIndicators( stdIndicators, resolved );
|
||||
|
@ -148,7 +148,7 @@ public class InferredBasicValueResolver {
|
|||
jdbcMapping,
|
||||
jdbcMapping.getJavaTypeDescriptor(),
|
||||
jdbcMapping.getJavaTypeDescriptor(),
|
||||
jdbcMapping.getSqlTypeDescriptor(),
|
||||
jdbcMapping.getJdbcTypeDescriptor(),
|
||||
null,
|
||||
legacyType,
|
||||
null
|
||||
|
@ -157,7 +157,7 @@ public class InferredBasicValueResolver {
|
|||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static BasicType<?> resolveSqlTypeIndicators(
|
||||
SqlTypeDescriptorIndicators stdIndicators,
|
||||
JdbcTypeDescriptorIndicators stdIndicators,
|
||||
BasicType<?> resolved) {
|
||||
if ( resolved instanceof SqlTypeDescriptorIndicatorCapable ) {
|
||||
final SqlTypeDescriptorIndicatorCapable indicatorCapable = (SqlTypeDescriptorIndicatorCapable) resolved;
|
||||
|
@ -173,8 +173,8 @@ public class InferredBasicValueResolver {
|
|||
public static InferredBasicValueResolution fromEnum(
|
||||
EnumJavaTypeDescriptor enumJavaDescriptor,
|
||||
BasicJavaDescriptor explicitJavaType,
|
||||
SqlTypeDescriptor explicitSqlType,
|
||||
SqlTypeDescriptorIndicators stdIndicators,
|
||||
JdbcTypeDescriptor explicitJdbcType,
|
||||
JdbcTypeDescriptorIndicators stdIndicators,
|
||||
TypeConfiguration typeConfiguration) {
|
||||
final EnumType enumStyle = stdIndicators.getEnumeratedType() != null
|
||||
? stdIndicators.getEnumeratedType()
|
||||
|
@ -199,12 +199,12 @@ public class InferredBasicValueResolver {
|
|||
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
|
||||
final NamedEnumValueConverter valueConverter = new NamedEnumValueConverter(
|
||||
enumJavaDescriptor,
|
||||
std,
|
||||
jdbcTypeDescriptor,
|
||||
relationalJtd
|
||||
);
|
||||
|
||||
|
@ -217,14 +217,14 @@ public class InferredBasicValueResolver {
|
|||
|
||||
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
|
||||
return new InferredBasicValueResolution(
|
||||
jdbcMapping,
|
||||
enumJavaDescriptor,
|
||||
relationalJtd,
|
||||
std,
|
||||
jdbcTypeDescriptor,
|
||||
valueConverter,
|
||||
legacyEnumTypeWrapper,
|
||||
ImmutableMutabilityPlan.INSTANCE
|
||||
|
@ -247,12 +247,12 @@ public class InferredBasicValueResolver {
|
|||
relationalJtd = typeConfiguration.getJavaTypeDescriptorRegistry().getDescriptor( Integer.class );
|
||||
}
|
||||
|
||||
final SqlTypeDescriptor std = explicitSqlType != null ? explicitSqlType : TinyIntTypeDescriptor.INSTANCE;
|
||||
final JdbcTypeDescriptor jdbcTypeDescriptor = explicitJdbcType != null ? explicitJdbcType : TinyIntTypeDescriptor.INSTANCE;
|
||||
|
||||
//noinspection unchecked
|
||||
final OrdinalEnumValueConverter valueConverter = new OrdinalEnumValueConverter(
|
||||
enumJavaDescriptor,
|
||||
std,
|
||||
jdbcTypeDescriptor,
|
||||
relationalJtd
|
||||
);
|
||||
|
||||
|
@ -265,14 +265,14 @@ public class InferredBasicValueResolver {
|
|||
|
||||
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
|
||||
return new InferredBasicValueResolution(
|
||||
jdbcMapping,
|
||||
enumJavaDescriptor,
|
||||
relationalJtd,
|
||||
std,
|
||||
jdbcTypeDescriptor,
|
||||
valueConverter,
|
||||
legacyEnumTypeWrapper,
|
||||
ImmutableMutabilityPlan.INSTANCE
|
||||
|
@ -288,8 +288,8 @@ public class InferredBasicValueResolver {
|
|||
public static InferredBasicValueResolution fromTemporal(
|
||||
TemporalJavaTypeDescriptor reflectedJtd,
|
||||
Function<TypeConfiguration, BasicJavaDescriptor> explicitJavaTypeAccess,
|
||||
Function<TypeConfiguration, SqlTypeDescriptor> explicitSqlTypeAccess,
|
||||
SqlTypeDescriptorIndicators stdIndicators,
|
||||
Function<TypeConfiguration, JdbcTypeDescriptor> explicitSqlTypeAccess,
|
||||
JdbcTypeDescriptorIndicators stdIndicators,
|
||||
TypeConfiguration typeConfiguration) {
|
||||
final TemporalType requestedTemporalPrecision = stdIndicators.getTemporalPrecision();
|
||||
|
||||
|
@ -301,12 +301,12 @@ public class InferredBasicValueResolver {
|
|||
explicitJavaType = null;
|
||||
}
|
||||
|
||||
final SqlTypeDescriptor explicitSqlType;
|
||||
final JdbcTypeDescriptor explicitJdbcType;
|
||||
if ( explicitSqlTypeAccess != null ) {
|
||||
explicitSqlType = explicitSqlTypeAccess.apply( typeConfiguration );
|
||||
explicitJdbcType = explicitSqlTypeAccess.apply( typeConfiguration );
|
||||
}
|
||||
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(
|
||||
jdbcMapping,
|
||||
explicitTemporalJtd,
|
||||
explicitTemporalJtd,
|
||||
std,
|
||||
jdbcTypeDescriptor,
|
||||
null,
|
||||
jdbcMapping,
|
||||
explicitJavaType.getMutabilityPlan()
|
||||
|
@ -351,7 +351,7 @@ public class InferredBasicValueResolver {
|
|||
// - still a special case because we want to perform the new resolution
|
||||
// due to the new annotations being used
|
||||
|
||||
if ( explicitSqlType != null ) {
|
||||
if ( explicitJdbcType != null ) {
|
||||
final TemporalJavaTypeDescriptor jtd;
|
||||
|
||||
if ( requestedTemporalPrecision != null ) {
|
||||
|
@ -364,13 +364,13 @@ public class InferredBasicValueResolver {
|
|||
jtd = reflectedJtd;
|
||||
}
|
||||
|
||||
final BasicType jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve( jtd, explicitSqlType );
|
||||
final BasicType jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve( jtd, explicitJdbcType );
|
||||
|
||||
return new InferredBasicValueResolution(
|
||||
jdbcMapping,
|
||||
jtd,
|
||||
jtd,
|
||||
explicitSqlType,
|
||||
explicitJdbcType,
|
||||
null,
|
||||
jdbcMapping,
|
||||
jtd.getMutabilityPlan()
|
||||
|
@ -401,7 +401,7 @@ public class InferredBasicValueResolver {
|
|||
basicType,
|
||||
basicType.getJavaTypeDescriptor(),
|
||||
basicType.getJavaTypeDescriptor(),
|
||||
basicType.getSqlTypeDescriptor(),
|
||||
basicType.getJdbcTypeDescriptor(),
|
||||
null,
|
||||
basicType,
|
||||
reflectedJtd.getMutabilityPlan()
|
||||
|
|
|
@ -13,10 +13,9 @@ import org.hibernate.mapping.BasicValue;
|
|||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||
import org.hibernate.metamodel.model.convert.spi.BasicValueConverter;
|
||||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -76,8 +75,8 @@ public class NamedBasicTypeResolution<J> implements BasicValue.Resolution<J> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor getRelationalSqlTypeDescriptor() {
|
||||
return basicType.getSqlTypeDescriptor();
|
||||
public JdbcTypeDescriptor getJdbcTypeDescriptor() {
|
||||
return basicType.getJdbcTypeDescriptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
*/
|
||||
package org.hibernate.boot.model.process.internal;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
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.classloading.spi.ClassLoaderService;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.mapping.BasicValue;
|
||||
import org.hibernate.mapping.IndexedConsumer;
|
||||
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.sql.ast.Clause;
|
||||
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.AttributeConverterTypeAdapter;
|
||||
import org.hibernate.type.descriptor.java.BasicJavaDescriptor;
|
||||
import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
/**
|
||||
|
@ -47,9 +38,9 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
|
|||
public static NamedConverterResolution from(
|
||||
ConverterDescriptor converterDescriptor,
|
||||
Function<TypeConfiguration, BasicJavaDescriptor> explicitJtdAccess,
|
||||
Function<TypeConfiguration, SqlTypeDescriptor> explicitStdAccess,
|
||||
Function<TypeConfiguration, JdbcTypeDescriptor> explicitStdAccess,
|
||||
Function<TypeConfiguration, MutabilityPlan> explicitMutabilityPlanAccess,
|
||||
SqlTypeDescriptorIndicators sqlTypeIndicators,
|
||||
JdbcTypeDescriptorIndicators sqlTypeIndicators,
|
||||
JpaAttributeConverterCreationContext converterCreationContext,
|
||||
MetadataBuildingContext context) {
|
||||
return fromInternal(
|
||||
|
@ -65,9 +56,9 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
|
|||
public static NamedConverterResolution from(
|
||||
String name,
|
||||
Function<TypeConfiguration, BasicJavaDescriptor> explicitJtdAccess,
|
||||
Function<TypeConfiguration, SqlTypeDescriptor> explicitStdAccess,
|
||||
Function<TypeConfiguration, JdbcTypeDescriptor> explicitStdAccess,
|
||||
Function<TypeConfiguration, MutabilityPlan> explicitMutabilityPlanAccess,
|
||||
SqlTypeDescriptorIndicators sqlTypeIndicators,
|
||||
JdbcTypeDescriptorIndicators sqlTypeIndicators,
|
||||
JpaAttributeConverterCreationContext converterCreationContext,
|
||||
MetadataBuildingContext context) {
|
||||
assert name.startsWith( ConverterDescriptor.TYPE_NAME_PREFIX );
|
||||
|
@ -94,9 +85,9 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
|
|||
|
||||
private static NamedConverterResolution fromInternal(
|
||||
Function<TypeConfiguration, BasicJavaDescriptor> explicitJtdAccess,
|
||||
Function<TypeConfiguration, SqlTypeDescriptor> explicitStdAccess,
|
||||
Function<TypeConfiguration, JdbcTypeDescriptor> explicitStdAccess,
|
||||
Function<TypeConfiguration, MutabilityPlan> explicitMutabilityPlanAccess,
|
||||
JpaAttributeConverter converter, SqlTypeDescriptorIndicators sqlTypeIndicators,
|
||||
JpaAttributeConverter converter, JdbcTypeDescriptorIndicators sqlTypeIndicators,
|
||||
MetadataBuildingContext context) {
|
||||
final TypeConfiguration typeConfiguration = context.getBootstrapContext().getTypeConfiguration();
|
||||
|
||||
|
@ -108,15 +99,15 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
|
|||
? explicitJtd
|
||||
: converter.getDomainJavaDescriptor();
|
||||
|
||||
final SqlTypeDescriptor explicitStd = explicitStdAccess != null
|
||||
final JdbcTypeDescriptor explicitJdbcType = explicitStdAccess != null
|
||||
? explicitStdAccess.apply( typeConfiguration )
|
||||
: null;
|
||||
|
||||
final JavaTypeDescriptor relationalJtd = converter.getRelationalJavaDescriptor();
|
||||
|
||||
final SqlTypeDescriptor relationalStd = explicitStd != null
|
||||
? explicitStd
|
||||
: relationalJtd.getJdbcRecommendedSqlType( sqlTypeIndicators );
|
||||
final JdbcTypeDescriptor jdbcType = explicitJdbcType != null
|
||||
? explicitJdbcType
|
||||
: relationalJtd.getRecommendedJdbcType( sqlTypeIndicators );
|
||||
|
||||
final MutabilityPlan explicitMutabilityPlan = explicitMutabilityPlanAccess != null
|
||||
? explicitMutabilityPlanAccess.apply( typeConfiguration )
|
||||
|
@ -137,7 +128,7 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
|
|||
return new NamedConverterResolution(
|
||||
domainJtd,
|
||||
relationalJtd,
|
||||
relationalStd,
|
||||
jdbcType,
|
||||
converter,
|
||||
mutabilityPlan,
|
||||
context.getBootstrapContext().getTypeConfiguration()
|
||||
|
@ -147,7 +138,7 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
|
|||
|
||||
private final JavaTypeDescriptor domainJtd;
|
||||
private final JavaTypeDescriptor relationalJtd;
|
||||
private final SqlTypeDescriptor relationalStd;
|
||||
private final JdbcTypeDescriptor jdbcTypeDescriptor;
|
||||
|
||||
private final JpaAttributeConverter valueConverter;
|
||||
private final MutabilityPlan mutabilityPlan;
|
||||
|
@ -160,7 +151,7 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
|
|||
public NamedConverterResolution(
|
||||
JavaTypeDescriptor domainJtd,
|
||||
JavaTypeDescriptor relationalJtd,
|
||||
SqlTypeDescriptor relationalStd,
|
||||
JdbcTypeDescriptor jdbcTypeDescriptor,
|
||||
JpaAttributeConverter valueConverter,
|
||||
MutabilityPlan mutabilityPlan,
|
||||
TypeConfiguration typeConfiguration) {
|
||||
|
@ -170,8 +161,8 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
|
|||
assert relationalJtd != null;
|
||||
this.relationalJtd = relationalJtd;
|
||||
|
||||
assert relationalStd != null;
|
||||
this.relationalStd = relationalStd;
|
||||
assert jdbcTypeDescriptor != null;
|
||||
this.jdbcTypeDescriptor = jdbcTypeDescriptor;
|
||||
|
||||
assert valueConverter != null;
|
||||
this.valueConverter = valueConverter;
|
||||
|
@ -181,7 +172,7 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
|
|||
|
||||
this.jdbcMapping = typeConfiguration.getBasicTypeRegistry().resolve(
|
||||
relationalJtd,
|
||||
relationalStd
|
||||
jdbcTypeDescriptor
|
||||
);
|
||||
// this.jdbcMapping = new JdbcMapping() {
|
||||
// private final ValueExtractor extractor = relationalStd.getExtractor( relationalJtd );
|
||||
|
@ -225,7 +216,7 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
|
|||
relationalJtd.getJavaType().getTypeName()
|
||||
),
|
||||
valueConverter,
|
||||
relationalStd,
|
||||
jdbcTypeDescriptor,
|
||||
relationalJtd,
|
||||
domainJtd,
|
||||
mutabilityPlan
|
||||
|
@ -250,8 +241,8 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor getRelationalSqlTypeDescriptor() {
|
||||
return relationalStd;
|
||||
public JdbcTypeDescriptor getJdbcTypeDescriptor() {
|
||||
return jdbcTypeDescriptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -275,140 +266,4 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,10 +11,9 @@ import org.hibernate.metamodel.mapping.JdbcMapping;
|
|||
import org.hibernate.metamodel.model.convert.spi.BasicValueConverter;
|
||||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.CustomType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
|
@ -43,8 +42,8 @@ public class UserTypeResolution implements BasicValue.Resolution {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor getRelationalSqlTypeDescriptor() {
|
||||
return userTypeAdapter.getSqlTypeDescriptor();
|
||||
public JdbcTypeDescriptor getJdbcTypeDescriptor() {
|
||||
return userTypeAdapter.getJdbcTypeDescriptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,8 +20,8 @@ import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
|
|||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
||||
import org.hibernate.type.descriptor.java.PrimitiveByteArrayTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
/**
|
||||
|
@ -37,7 +37,7 @@ public class VersionResolution<E> implements BasicValue.Resolution<E> {
|
|||
public static <E> VersionResolution<E> from(
|
||||
Function<TypeConfiguration, java.lang.reflect.Type> implicitJavaTypeAccess,
|
||||
Function<TypeConfiguration, BasicJavaDescriptor> explicitJtdAccess,
|
||||
Function<TypeConfiguration, SqlTypeDescriptor> explicitStdAccess,
|
||||
Function<TypeConfiguration, JdbcTypeDescriptor> explicitStdAccess,
|
||||
TypeConfiguration typeConfiguration,
|
||||
@SuppressWarnings("unused") MetadataBuildingContext context) {
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class VersionResolution<E> implements BasicValue.Resolution<E> {
|
|||
if ( registered instanceof PrimitiveByteArrayTypeDescriptor ) {
|
||||
return new VersionResolution<>(
|
||||
RowVersionType.INSTANCE.getJavaTypeDescriptor(),
|
||||
RowVersionType.INSTANCE.getSqlTypeDescriptor(),
|
||||
RowVersionType.INSTANCE.getJdbcTypeDescriptor(),
|
||||
RowVersionType.INSTANCE,
|
||||
RowVersionType.INSTANCE
|
||||
);
|
||||
|
@ -57,8 +57,8 @@ public class VersionResolution<E> implements BasicValue.Resolution<E> {
|
|||
|
||||
final BasicJavaDescriptor jtd = (BasicJavaDescriptor) registered;
|
||||
|
||||
final SqlTypeDescriptor std = jtd.getJdbcRecommendedSqlType(
|
||||
new SqlTypeDescriptorIndicators() {
|
||||
final JdbcTypeDescriptor recommendedJdbcType = jtd.getRecommendedJdbcType(
|
||||
new JdbcTypeDescriptorIndicators() {
|
||||
@Override
|
||||
public TypeConfiguration getTypeConfiguration() {
|
||||
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() );
|
||||
|
||||
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 SqlTypeDescriptor std;
|
||||
private final JdbcTypeDescriptor jdbcTypeDescriptor;
|
||||
|
||||
private final JdbcMapping jdbcMapping;
|
||||
private final BasicType legacyType;
|
||||
|
||||
public VersionResolution(
|
||||
JavaTypeDescriptor javaTypeDescriptor,
|
||||
SqlTypeDescriptor sqlTypeDescriptor,
|
||||
JdbcTypeDescriptor jdbcTypeDescriptor,
|
||||
JdbcMapping jdbcMapping,
|
||||
BasicType legacyType) {
|
||||
this.jtd = javaTypeDescriptor;
|
||||
this.std = sqlTypeDescriptor;
|
||||
this.jdbcTypeDescriptor = jdbcTypeDescriptor;
|
||||
this.jdbcMapping = jdbcMapping;
|
||||
this.legacyType = legacyType;
|
||||
}
|
||||
|
@ -120,8 +120,8 @@ public class VersionResolution<E> implements BasicValue.Resolution<E> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor getRelationalSqlTypeDescriptor() {
|
||||
return std;
|
||||
public JdbcTypeDescriptor getJdbcTypeDescriptor() {
|
||||
return jdbcTypeDescriptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.hibernate.boot.model.source.spi.MetadataSourceProcessor;
|
|||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||
import org.hibernate.boot.spi.AdditionalJaxbMappingProducer;
|
||||
import org.hibernate.boot.spi.BootstrapContext;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.boot.spi.MetadataBuildingOptions;
|
||||
import org.hibernate.boot.spi.MetadataContributor;
|
||||
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.BasicTypeRegistry;
|
||||
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.usertype.UserType;
|
||||
|
||||
|
@ -374,8 +373,8 @@ public class MetadataBuildingProcess {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void contributeSqlTypeDescriptor(SqlTypeDescriptor descriptor) {
|
||||
bootstrapContext.getTypeConfiguration().getSqlTypeDescriptorRegistry().addDescriptor( descriptor );
|
||||
public void contributeJdbcTypeDescriptor(JdbcTypeDescriptor descriptor) {
|
||||
bootstrapContext.getTypeConfiguration().getJdbcTypeDescriptorRegistry().addDescriptor( descriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1983,7 +1983,7 @@ public class ModelBinder {
|
|||
.getBasicTypeRegistry()
|
||||
.getRegisteredType( value.getTypeName() );
|
||||
if ( basicType instanceof AbstractSingleColumnStandardBasicType ) {
|
||||
if ( isLob( basicType.getSqlTypeDescriptor().getSqlType(), null ) ) {
|
||||
if ( isLob( basicType.getJdbcTypeDescriptor().getJdbcType(), null ) ) {
|
||||
value.makeLob();
|
||||
}
|
||||
}
|
||||
|
@ -2004,9 +2004,9 @@ public class ModelBinder {
|
|||
|
||||
private static boolean isLob(Integer sqlType, String sqlTypeName) {
|
||||
if ( sqlType != null ) {
|
||||
return ClobType.INSTANCE.getSqlTypeDescriptor().getSqlType() == sqlType ||
|
||||
BlobType.INSTANCE.getSqlTypeDescriptor().getSqlType() == sqlType ||
|
||||
NClobType.INSTANCE.getSqlTypeDescriptor().getSqlType() == sqlType;
|
||||
return ClobType.INSTANCE.getJdbcTypeDescriptor().getJdbcType() == sqlType ||
|
||||
BlobType.INSTANCE.getJdbcTypeDescriptor().getJdbcType() == sqlType ||
|
||||
NClobType.INSTANCE.getJdbcTypeDescriptor().getJdbcType() == sqlType;
|
||||
}
|
||||
else if ( sqlTypeName != null ) {
|
||||
return ClobType.INSTANCE.getName().equalsIgnoreCase( sqlTypeName ) ||
|
||||
|
|
|
@ -52,7 +52,7 @@ import org.hibernate.mapping.MappedSuperclass;
|
|||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.mapping.Table;
|
||||
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.
|
||||
|
@ -320,7 +320,7 @@ public interface InFlightMetadataCollector extends Mapping, MetadataImplementor
|
|||
void registerValueMappingResolver(Function<MetadataBuildingContext,Boolean> resolver);
|
||||
|
||||
void addJavaTypeRegistration(Class<?> javaType, JavaTypeDescriptor<?> jtd);
|
||||
void addSqlTypeRegistration(int typeCode, SqlTypeDescriptor std);
|
||||
void addJdbcTypeRegistration(int typeCode, JdbcTypeDescriptor jdbcTypeDescriptor);
|
||||
|
||||
interface DelayedPropertyReferenceHandler extends Serializable {
|
||||
void process(InFlightMetadataCollector metadataCollector);
|
||||
|
|
|
@ -8,7 +8,6 @@ package org.hibernate.cfg;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
|
@ -119,8 +118,8 @@ import org.hibernate.annotations.Proxy;
|
|||
import org.hibernate.annotations.SortComparator;
|
||||
import org.hibernate.annotations.SortNatural;
|
||||
import org.hibernate.annotations.Source;
|
||||
import org.hibernate.annotations.SqlTypeRegistration;
|
||||
import org.hibernate.annotations.SqlTypeRegistrations;
|
||||
import org.hibernate.annotations.JdbcTypeRegistration;
|
||||
import org.hibernate.annotations.JdbcTypeRegistrations;
|
||||
import org.hibernate.annotations.TypeDef;
|
||||
import org.hibernate.annotations.TypeDefs;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
@ -171,7 +170,7 @@ import org.hibernate.mapping.ToOne;
|
|||
import org.hibernate.mapping.UnionSubclass;
|
||||
import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
|
||||
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;
|
||||
|
||||
|
@ -357,14 +356,14 @@ public final class AnnotationBinder {
|
|||
private static void handleSqlTypeDescriptorRegistration(
|
||||
MetadataBuildingContext context,
|
||||
ManagedBeanRegistry managedBeanRegistry,
|
||||
SqlTypeRegistration annotation) {
|
||||
final Class<? extends SqlTypeDescriptor> stdClass = annotation.value();
|
||||
final SqlTypeDescriptor std = managedBeanRegistry.getBean( stdClass ).getBeanInstance();
|
||||
JdbcTypeRegistration annotation) {
|
||||
final Class<? extends JdbcTypeDescriptor> jdbcTypeClass = annotation.value();
|
||||
final JdbcTypeDescriptor jdbcTypeDescriptor = managedBeanRegistry.getBean( jdbcTypeClass ).getBeanInstance();
|
||||
|
||||
final int typeCode = annotation.registrationCode() == Integer.MIN_VALUE
|
||||
? std.getJdbcTypeCode()
|
||||
? jdbcTypeDescriptor.getJdbcTypeCode()
|
||||
: annotation.registrationCode();
|
||||
context.getMetadataCollector().addSqlTypeRegistration( typeCode, std );
|
||||
context.getMetadataCollector().addJdbcTypeRegistration( typeCode, jdbcTypeDescriptor );
|
||||
}
|
||||
|
||||
private static void handleJavaTypeDescriptorRegistration(
|
||||
|
@ -883,13 +882,13 @@ public final class AnnotationBinder {
|
|||
}
|
||||
}
|
||||
|
||||
if ( annotatedElement.isAnnotationPresent( SqlTypeRegistration.class ) ) {
|
||||
final SqlTypeRegistration annotation = annotatedElement.getAnnotation( SqlTypeRegistration.class );
|
||||
if ( annotatedElement.isAnnotationPresent( JdbcTypeRegistration.class ) ) {
|
||||
final JdbcTypeRegistration annotation = annotatedElement.getAnnotation( JdbcTypeRegistration.class );
|
||||
handleSqlTypeDescriptorRegistration( context, managedBeanRegistry, annotation );
|
||||
}
|
||||
if ( annotatedElement.isAnnotationPresent( SqlTypeRegistrations.class ) ) {
|
||||
final SqlTypeRegistrations annotation = annotatedElement.getAnnotation( SqlTypeRegistrations.class );
|
||||
final SqlTypeRegistration[] registrations = annotation.value();
|
||||
if ( annotatedElement.isAnnotationPresent( JdbcTypeRegistrations.class ) ) {
|
||||
final JdbcTypeRegistrations annotation = annotatedElement.getAnnotation( JdbcTypeRegistrations.class );
|
||||
final JdbcTypeRegistration[] registrations = annotation.value();
|
||||
for ( int i = 0; i < registrations.length; i++ ) {
|
||||
handleSqlTypeDescriptorRegistration( context, managedBeanRegistry, registrations[i] );
|
||||
}
|
||||
|
|
|
@ -27,14 +27,14 @@ import org.hibernate.annotations.CollectionId;
|
|||
import org.hibernate.annotations.Immutable;
|
||||
import org.hibernate.annotations.JavaType;
|
||||
import org.hibernate.annotations.MapKeyJavaType;
|
||||
import org.hibernate.annotations.MapKeySqlType;
|
||||
import org.hibernate.annotations.MapKeySqlTypeCode;
|
||||
import org.hibernate.annotations.MapKeyJdbcType;
|
||||
import org.hibernate.annotations.MapKeyJdbcTypeCode;
|
||||
import org.hibernate.annotations.MapKeyType;
|
||||
import org.hibernate.annotations.Mutability;
|
||||
import org.hibernate.annotations.Nationalized;
|
||||
import org.hibernate.annotations.Parameter;
|
||||
import org.hibernate.annotations.SqlType;
|
||||
import org.hibernate.annotations.SqlTypeCode;
|
||||
import org.hibernate.annotations.JdbcType;
|
||||
import org.hibernate.annotations.JdbcTypeCode;
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.hibernate.annotations.common.reflection.XClass;
|
||||
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.ImmutableMutabilityPlan;
|
||||
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
@ -67,7 +67,7 @@ import org.jboss.logging.Logger;
|
|||
* @author Steve Ebersole
|
||||
* @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
|
||||
// see the comments in #setType
|
||||
|
@ -97,7 +97,7 @@ public class BasicValueBinder<T> implements SqlTypeDescriptorIndicators {
|
|||
private String explicitBasicTypeName;
|
||||
private Map explicitLocalTypeParams;
|
||||
|
||||
private Function<TypeConfiguration,SqlTypeDescriptor> explicitSqlTypeAccess;
|
||||
private Function<TypeConfiguration, JdbcTypeDescriptor> explicitSqlTypeAccess;
|
||||
private Function<TypeConfiguration, BasicJavaDescriptor> explicitJtdAccess;
|
||||
private Function<TypeConfiguration, MutabilityPlan> explicitMutabilityAccess;
|
||||
private Function<TypeConfiguration, java.lang.reflect.Type> implicitJavaTypeAccess;
|
||||
|
@ -508,10 +508,10 @@ public class BasicValueBinder<T> implements SqlTypeDescriptorIndicators {
|
|||
}
|
||||
|
||||
explicitSqlTypeAccess = typeConfiguration -> {
|
||||
final MapKeySqlType explicitDescriptorAnn = attributeXProperty.getAnnotation( MapKeySqlType.class );
|
||||
final MapKeyJdbcType explicitDescriptorAnn = attributeXProperty.getAnnotation( MapKeyJdbcType.class );
|
||||
if ( explicitDescriptorAnn != null ) {
|
||||
final SqlType explicitStdAnn = explicitDescriptorAnn.value();
|
||||
final Class<? extends SqlTypeDescriptor> stdImplJavaType = explicitStdAnn.value();
|
||||
final JdbcType explicitStdAnn = explicitDescriptorAnn.value();
|
||||
final Class<? extends JdbcTypeDescriptor> stdImplJavaType = explicitStdAnn.value();
|
||||
|
||||
try {
|
||||
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 ) {
|
||||
final SqlTypeCode explicitSqlTypeAnn = explicitCodeAnn.value();
|
||||
return typeConfiguration.getSqlTypeDescriptorRegistry().getDescriptor( explicitSqlTypeAnn.value() );
|
||||
final JdbcTypeCode explicitSqlTypeAnn = explicitCodeAnn.value();
|
||||
return typeConfiguration.getJdbcTypeDescriptorRegistry().getDescriptor( explicitSqlTypeAnn.value() );
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -552,9 +552,9 @@ public class BasicValueBinder<T> implements SqlTypeDescriptorIndicators {
|
|||
XProperty attributeXProperty,
|
||||
MetadataBuildingContext buildingContext) {
|
||||
explicitSqlTypeAccess = typeConfiguration -> {
|
||||
final SqlType explicitStdAnn = attributeXProperty.getAnnotation( SqlType.class );
|
||||
final JdbcType explicitStdAnn = attributeXProperty.getAnnotation( JdbcType.class );
|
||||
if ( explicitStdAnn != null ) {
|
||||
final Class<? extends SqlTypeDescriptor> stdImplJavaType = explicitStdAnn.value();
|
||||
final Class<? extends JdbcTypeDescriptor> stdImplJavaType = explicitStdAnn.value();
|
||||
|
||||
try {
|
||||
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 ) {
|
||||
return typeConfiguration.getSqlTypeDescriptorRegistry().getDescriptor( explicitSqlTypeAnn.value() );
|
||||
return typeConfiguration.getJdbcTypeDescriptorRegistry().getDescriptor( explicitSqlTypeAnn.value() );
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -55,7 +55,7 @@ import org.hibernate.type.descriptor.ValueExtractor;
|
|||
import org.hibernate.type.descriptor.WrapperOptions;
|
||||
import org.hibernate.type.descriptor.java.DataHelper;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.*;
|
||||
import org.hibernate.type.descriptor.jdbc.*;
|
||||
|
||||
import java.io.*;
|
||||
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;
|
||||
|
||||
|
@ -298,7 +298,7 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getSqlType() {
|
||||
public int getJdbcType() {
|
||||
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;
|
||||
|
||||
|
@ -583,7 +583,7 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getSqlType() {
|
||||
public int getJdbcType() {
|
||||
return Types.BLOB;
|
||||
}
|
||||
|
||||
|
@ -634,7 +634,7 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
|
||||
@Override
|
||||
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 ) ) {
|
||||
// performance shortcut for binding BLOB data in byte[] format
|
||||
descriptor = BlobTypeDescriptor.PRIMITIVE_ARRAY_BINDING;
|
||||
|
@ -647,7 +647,7 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
|
||||
@Override
|
||||
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 ) ) {
|
||||
// performance shortcut for binding BLOB data in byte[] format
|
||||
descriptor = BlobTypeDescriptor.PRIMITIVE_ARRAY_BINDING;
|
||||
|
@ -1002,7 +1002,7 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(final int sqlCode) {
|
||||
protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(final int sqlCode) {
|
||||
switch ( sqlCode ) {
|
||||
case Types.CLOB:
|
||||
return this.clobTypeDescriptor;
|
||||
|
@ -1475,7 +1475,7 @@ public abstract class AbstractHANADialect extends Dialect {
|
|||
}
|
||||
}
|
||||
|
||||
public SqlTypeDescriptor getBlobTypeDescriptor() {
|
||||
public JdbcTypeDescriptor getBlobTypeDescriptor() {
|
||||
return this.blobTypeDescriptor;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.TempIdTableExporter;
|
||||
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.ResultSet;
|
||||
|
@ -68,15 +68,15 @@ abstract class AbstractTransactSQLDialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor resolveSqlTypeDescriptor(
|
||||
public JdbcTypeDescriptor resolveSqlTypeDescriptor(
|
||||
int jdbcTypeCode,
|
||||
int precision,
|
||||
int scale,
|
||||
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) {
|
||||
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
|
||||
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
|
||||
|
|
|
@ -27,8 +27,8 @@ import org.hibernate.sql.ast.tree.Statement;
|
|||
import org.hibernate.sql.exec.spi.JdbcOperation;
|
||||
import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorCUBRIDDatabaseImpl;
|
||||
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
|
||||
|
||||
import java.sql.Types;
|
||||
|
||||
|
@ -104,15 +104,15 @@ public class CUBRIDDialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor resolveSqlTypeDescriptor(
|
||||
public JdbcTypeDescriptor resolveSqlTypeDescriptor(
|
||||
int jdbcTypeCode,
|
||||
int precision,
|
||||
int scale,
|
||||
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) {
|
||||
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
|
||||
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
|
||||
|
|
|
@ -34,8 +34,8 @@ import org.hibernate.sql.ast.spi.StandardSqlAstTranslatorFactory;
|
|||
import org.hibernate.sql.ast.tree.Statement;
|
||||
import org.hibernate.sql.exec.spi.JdbcOperation;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.ResultSet;
|
||||
|
@ -87,15 +87,15 @@ public class CacheDialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor resolveSqlTypeDescriptor(
|
||||
public JdbcTypeDescriptor resolveSqlTypeDescriptor(
|
||||
int jdbcTypeCode,
|
||||
int precision,
|
||||
int scale,
|
||||
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) {
|
||||
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
|
||||
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
|
||||
|
|
|
@ -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.spi.SequenceInformationExtractor;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.descriptor.sql.*;
|
||||
import org.hibernate.type.descriptor.jdbc.*;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.ResultSet;
|
||||
|
@ -520,7 +520,7 @@ public class DB2Dialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
|
||||
protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
|
||||
final int version = getVersion();
|
||||
|
||||
if ( version < 1100 && sqlCode == Types.BOOLEAN ) {
|
||||
|
|
|
@ -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.spi.SequenceInformationExtractor;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.descriptor.sql.DecimalTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SmallIntTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.TimestampTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.DecimalTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.SmallIntTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.TimestampTypeDescriptor;
|
||||
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
|
@ -487,7 +487,7 @@ public class DerbyDialect extends Dialect {
|
|||
return false;
|
||||
}
|
||||
|
||||
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
|
||||
protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
|
||||
if ( getVersion() < 1070 && sqlCode == Types.BOOLEAN) {
|
||||
return SmallIntTypeDescriptor.INSTANCE;
|
||||
}
|
||||
|
|
|
@ -83,9 +83,9 @@ import org.hibernate.tool.schema.spi.Exporter;
|
|||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.ClobTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry;
|
||||
import org.hibernate.type.descriptor.jdbc.ClobTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
|
||||
|
||||
import javax.persistence.TemporalType;
|
||||
import java.io.InputStream;
|
||||
|
@ -243,12 +243,12 @@ public abstract class Dialect implements ConversionContext {
|
|||
sizeStrategy = new SizeStrategyImpl();
|
||||
}
|
||||
|
||||
public SqlTypeDescriptor resolveSqlTypeDescriptor(
|
||||
public JdbcTypeDescriptor resolveSqlTypeDescriptor(
|
||||
int jdbcTypeCode,
|
||||
int precision,
|
||||
int scale,
|
||||
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) {
|
||||
return sqlTypeDescriptorRegistry.getDescriptor( jdbcTypeCode );
|
||||
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
|
||||
return jdbcTypeDescriptorRegistry.getDescriptor( jdbcTypeCode );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1018,12 +1018,12 @@ public abstract class Dialect implements ConversionContext {
|
|||
return paren>0 ? result.substring(0, paren) : result;
|
||||
}
|
||||
|
||||
public String getRawTypeName(SqlTypeDescriptor sqlTypeDescriptor) throws HibernateException {
|
||||
return getRawTypeName( sqlTypeDescriptor.getJdbcTypeCode() );
|
||||
public String getRawTypeName(JdbcTypeDescriptor jdbcTypeDescriptor) throws HibernateException {
|
||||
return getRawTypeName( jdbcTypeDescriptor.getJdbcTypeCode() );
|
||||
}
|
||||
|
||||
public String getTypeName(SqlTypeDescriptor sqlTypeDescriptor) throws HibernateException {
|
||||
return getTypeName( sqlTypeDescriptor.getJdbcTypeCode() );
|
||||
public String getTypeName(JdbcTypeDescriptor jdbcTypeDescriptor) throws HibernateException {
|
||||
return getTypeName( jdbcTypeDescriptor.getJdbcTypeCode() );
|
||||
}
|
||||
|
||||
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
|
||||
* <tt>SqlTypeDescriptor</tt>.
|
||||
*
|
||||
* @param sqlTypeDescriptor the SQL type
|
||||
* @param jdbcTypeDescriptor the SQL type
|
||||
* @param size the length, precision, scale of the column
|
||||
*
|
||||
* @return the database type name
|
||||
*
|
||||
*/
|
||||
public String getTypeName(SqlTypeDescriptor sqlTypeDescriptor, Size size) {
|
||||
return getTypeName( sqlTypeDescriptor.getJdbcTypeCode(), size );
|
||||
public String getTypeName(JdbcTypeDescriptor jdbcTypeDescriptor, Size size) {
|
||||
return getTypeName( jdbcTypeDescriptor.getJdbcTypeCode(), size );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1103,7 +1103,7 @@ public abstract class Dialect implements ConversionContext {
|
|||
if ( length == null && precision == null ) {
|
||||
//use defaults
|
||||
size = getSizeStrategy().resolveSize(
|
||||
type.getJdbcMapping().getSqlTypeDescriptor(),
|
||||
type.getJdbcMapping().getJdbcTypeDescriptor(),
|
||||
type.getJdbcMapping().getJavaTypeDescriptor(),
|
||||
precision,
|
||||
scale,
|
||||
|
@ -1122,7 +1122,7 @@ public abstract class Dialect implements ConversionContext {
|
|||
.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/>
|
||||
* 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 SqlTypeDescriptor#getJdbcTypeCode()}.
|
||||
* {@link JdbcTypeDescriptor#getJdbcTypeCode()}.
|
||||
* <p/>
|
||||
* 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}
|
||||
*
|
||||
* @param sqlTypeDescriptor The {@link SqlTypeDescriptor} to override
|
||||
* @return The {@link SqlTypeDescriptor} that should be used for this dialect;
|
||||
* @param jdbcTypeDescriptor The {@link JdbcTypeDescriptor} to override
|
||||
* @return The {@link JdbcTypeDescriptor} that should be used for this dialect;
|
||||
* if there is no override, then original {@code sqlTypeDescriptor} is returned.
|
||||
* @throws IllegalArgumentException if {@code sqlTypeDescriptor} is null.
|
||||
*
|
||||
* @see #getSqlTypeDescriptorOverride
|
||||
*/
|
||||
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
|
||||
if ( sqlTypeDescriptor == null ) {
|
||||
public JdbcTypeDescriptor remapSqlTypeDescriptor(JdbcTypeDescriptor jdbcTypeDescriptor) {
|
||||
if ( jdbcTypeDescriptor == null ) {
|
||||
throw new IllegalArgumentException( "sqlTypeDescriptor is null" );
|
||||
}
|
||||
if ( ! sqlTypeDescriptor.canBeRemapped() ) {
|
||||
return sqlTypeDescriptor;
|
||||
if ( ! jdbcTypeDescriptor.canBeRemapped() ) {
|
||||
return jdbcTypeDescriptor;
|
||||
}
|
||||
|
||||
final SqlTypeDescriptor overridden = getSqlTypeDescriptorOverride( sqlTypeDescriptor.getJdbcTypeCode() );
|
||||
return overridden == null ? sqlTypeDescriptor : overridden;
|
||||
final JdbcTypeDescriptor overridden = getSqlTypeDescriptorOverride( jdbcTypeDescriptor.getJdbcTypeCode() );
|
||||
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.
|
||||
*
|
||||
* @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) {
|
||||
SqlTypeDescriptor descriptor;
|
||||
protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
|
||||
JdbcTypeDescriptor descriptor;
|
||||
switch ( sqlCode ) {
|
||||
case Types.CLOB: {
|
||||
descriptor = useInputStreamToInsertBlob() ? ClobTypeDescriptor.STREAM_BINDING : null;
|
||||
|
@ -3717,12 +3717,12 @@ public abstract class Dialect implements ConversionContext {
|
|||
public interface SizeStrategy {
|
||||
/**
|
||||
* 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}
|
||||
*/
|
||||
Size resolveSize(
|
||||
SqlTypeDescriptor sqlType,
|
||||
JdbcTypeDescriptor jdbcType,
|
||||
JavaTypeDescriptor javaType,
|
||||
Integer precision,
|
||||
Integer scale, Long length);
|
||||
|
@ -3731,13 +3731,13 @@ public abstract class Dialect implements ConversionContext {
|
|||
public class SizeStrategyImpl implements SizeStrategy {
|
||||
@Override
|
||||
public Size resolveSize(
|
||||
SqlTypeDescriptor sqlType,
|
||||
JdbcTypeDescriptor jdbcType,
|
||||
JavaTypeDescriptor javaType,
|
||||
Integer precision,
|
||||
Integer scale,
|
||||
Long length) {
|
||||
final Size size = new Size();
|
||||
int jdbcTypeCode = sqlType.getJdbcTypeCode();
|
||||
int jdbcTypeCode = jdbcType.getJdbcTypeCode();
|
||||
|
||||
switch (jdbcTypeCode) {
|
||||
case Types.BIT:
|
||||
|
|
|
@ -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.spi.SequenceInformationExtractor;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
|
||||
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
|
@ -162,15 +162,15 @@ public class FirebirdDialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor resolveSqlTypeDescriptor(
|
||||
public JdbcTypeDescriptor resolveSqlTypeDescriptor(
|
||||
int jdbcTypeCode,
|
||||
int precision,
|
||||
int scale,
|
||||
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) {
|
||||
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
|
||||
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
|
||||
|
|
|
@ -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.spi.SequenceInformationExtractor;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
|
||||
|
||||
import java.sql.Types;
|
||||
import javax.persistence.TemporalType;
|
||||
|
@ -159,15 +159,15 @@ public class IngresDialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor resolveSqlTypeDescriptor(
|
||||
public JdbcTypeDescriptor resolveSqlTypeDescriptor(
|
||||
int jdbcTypeCode,
|
||||
int precision,
|
||||
int scale,
|
||||
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) {
|
||||
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
|
||||
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
|
||||
|
|
|
@ -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.spi.SequenceInformationExtractor;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
|
||||
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.Types;
|
||||
|
@ -64,19 +64,19 @@ public class MaxDBDialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor resolveSqlTypeDescriptor(
|
||||
public JdbcTypeDescriptor resolveSqlTypeDescriptor(
|
||||
int jdbcTypeCode,
|
||||
int precision,
|
||||
int scale,
|
||||
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) {
|
||||
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
|
||||
switch ( jdbcTypeCode ) {
|
||||
case Types.NUMERIC:
|
||||
case Types.DECIMAL:
|
||||
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
|
||||
|
|
|
@ -48,8 +48,8 @@ import org.hibernate.sql.ast.tree.Statement;
|
|||
import org.hibernate.sql.exec.spi.JdbcOperation;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.ResultSet;
|
||||
|
@ -169,12 +169,12 @@ public class MySQLDialect extends Dialect {
|
|||
sizeStrategy = new SizeStrategyImpl() {
|
||||
@Override
|
||||
public Size resolveSize(
|
||||
SqlTypeDescriptor sqlType,
|
||||
JdbcTypeDescriptor jdbcType,
|
||||
JavaTypeDescriptor javaType,
|
||||
Integer precision,
|
||||
Integer scale,
|
||||
Long length) {
|
||||
final int jdbcTypeCode = sqlType.getSqlType();
|
||||
final int jdbcTypeCode = jdbcType.getJdbcType();
|
||||
switch ( jdbcTypeCode ) {
|
||||
case Types.BIT:
|
||||
// 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 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
|
||||
public SqlTypeDescriptor resolveSqlTypeDescriptor(
|
||||
public JdbcTypeDescriptor resolveSqlTypeDescriptor(
|
||||
int jdbcTypeCode,
|
||||
int precision,
|
||||
int scale,
|
||||
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) {
|
||||
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
|
||||
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
|
||||
|
@ -575,7 +575,7 @@ public class MySQLDialect extends Dialect {
|
|||
|
||||
@Override
|
||||
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.BIGINT:
|
||||
case Types.SMALLINT:
|
||||
|
|
|
@ -61,11 +61,11 @@ import org.hibernate.type.descriptor.JdbcTypeNameMapper;
|
|||
import org.hibernate.type.descriptor.ValueBinder;
|
||||
import org.hibernate.type.descriptor.WrapperOptions;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.BasicBinder;
|
||||
import org.hibernate.type.descriptor.sql.BlobTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.BooleanTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry;
|
||||
import org.hibernate.type.descriptor.jdbc.BasicBinder;
|
||||
import org.hibernate.type.descriptor.jdbc.BlobTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.BooleanTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
|
@ -600,11 +600,11 @@ public class OracleDialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor resolveSqlTypeDescriptor(
|
||||
public JdbcTypeDescriptor resolveSqlTypeDescriptor(
|
||||
int jdbcTypeCode,
|
||||
int precision,
|
||||
int scale,
|
||||
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) {
|
||||
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
|
||||
// This is the reverse of what registerNumericTypeMappings registers
|
||||
switch ( jdbcTypeCode ) {
|
||||
case Types.NUMERIC:
|
||||
|
@ -612,19 +612,19 @@ public class OracleDialect extends Dialect {
|
|||
if ( scale == 0 ) {
|
||||
switch ( precision ) {
|
||||
case 1:
|
||||
return sqlTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
|
||||
return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
|
||||
case 3:
|
||||
return sqlTypeDescriptorRegistry.getDescriptor( Types.TINYINT );
|
||||
return jdbcTypeDescriptorRegistry.getDescriptor( Types.TINYINT );
|
||||
case 5:
|
||||
return sqlTypeDescriptorRegistry.getDescriptor( Types.SMALLINT );
|
||||
return jdbcTypeDescriptorRegistry.getDescriptor( Types.SMALLINT );
|
||||
case 10:
|
||||
return sqlTypeDescriptorRegistry.getDescriptor( Types.INTEGER );
|
||||
return jdbcTypeDescriptorRegistry.getDescriptor( Types.INTEGER );
|
||||
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.DEFAULT;
|
||||
|
||||
typeContributions.contributeSqlTypeDescriptor( descriptor );
|
||||
typeContributions.contributeJdbcTypeDescriptor( descriptor );
|
||||
}
|
||||
typeContributions.contributeSqlTypeDescriptor( new OracleBooleanTypeDescriptor() );
|
||||
typeContributions.contributeJdbcTypeDescriptor( new OracleBooleanTypeDescriptor() );
|
||||
}
|
||||
|
||||
private static final class OracleBooleanTypeDescriptor extends BooleanTypeDescriptor {
|
||||
|
|
|
@ -47,12 +47,13 @@ import org.hibernate.type.descriptor.ValueExtractor;
|
|||
import org.hibernate.type.descriptor.WrapperOptions;
|
||||
import org.hibernate.type.descriptor.java.BasicJavaDescriptor;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.BasicBinder;
|
||||
import org.hibernate.type.descriptor.sql.BasicExtractor;
|
||||
import org.hibernate.type.descriptor.sql.BlobTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.ClobTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.JdbcLiteralFormatter;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.BasicBinder;
|
||||
import org.hibernate.type.descriptor.jdbc.BasicExtractor;
|
||||
import org.hibernate.type.descriptor.jdbc.BlobTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.ClobTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcLiteralFormatter;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
import java.sql.*;
|
||||
|
@ -327,7 +328,7 @@ public class PostgreSQLDialect extends Dialect {
|
|||
}
|
||||
|
||||
@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
|
||||
// <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>
|
||||
|
@ -822,11 +823,11 @@ public class PostgreSQLDialect extends Dialect {
|
|||
|
||||
if ( getVersion() >= 820 ) {
|
||||
// HHH-9562
|
||||
typeContributions.contributeSqlTypeDescriptor( PostgresUUIDType.INSTANCE );
|
||||
typeContributions.contributeJdbcTypeDescriptor( PostgresUUIDType.INSTANCE );
|
||||
}
|
||||
}
|
||||
|
||||
private static class PostgresUUIDType implements SqlTypeDescriptor {
|
||||
private static class PostgresUUIDType implements JdbcTypeDescriptor {
|
||||
/**
|
||||
* 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
|
||||
* value useless for distinguishing one SqlTypeDescriptor from another.
|
||||
* 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;
|
||||
|
||||
@Override
|
||||
public int getSqlType() {
|
||||
public int getJdbcType() {
|
||||
return JDBC_TYPE_CODE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getJdbcTypeCode() {
|
||||
return getSqlType();
|
||||
return getJdbcType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,8 +26,8 @@ import org.hibernate.sql.ast.SqlAstTranslatorFactory;
|
|||
import org.hibernate.sql.ast.spi.StandardSqlAstTranslatorFactory;
|
||||
import org.hibernate.sql.ast.tree.Statement;
|
||||
import org.hibernate.sql.exec.spi.JdbcOperation;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
|
@ -110,15 +110,15 @@ public class RDMSOS2200Dialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor resolveSqlTypeDescriptor(
|
||||
public JdbcTypeDescriptor resolveSqlTypeDescriptor(
|
||||
int jdbcTypeCode,
|
||||
int precision,
|
||||
int scale,
|
||||
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) {
|
||||
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
|
||||
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
|
||||
|
|
|
@ -33,8 +33,8 @@ import org.hibernate.sql.ast.spi.StandardSqlAstTranslatorFactory;
|
|||
import org.hibernate.sql.ast.tree.Statement;
|
||||
import org.hibernate.sql.exec.spi.JdbcOperation;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.descriptor.sql.SmallIntTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.SmallIntTypeDescriptor;
|
||||
|
||||
import java.sql.Types;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -129,7 +129,7 @@ public class SQLServerDialect extends AbstractTransactSQLDialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
|
||||
protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
|
||||
return sqlCode == Types.TINYINT
|
||||
? SmallIntTypeDescriptor.INSTANCE
|
||||
: super.getSqlTypeDescriptorOverride( sqlCode );
|
||||
|
|
|
@ -788,7 +788,7 @@ public class SpannerDialect extends Dialect {
|
|||
@Override
|
||||
public String getCastTypeName(SqlExpressable type, Long length, Integer precision, Integer scale) {
|
||||
//Spanner doesn't let you specify a length in cast() types
|
||||
return super.getRawTypeName( type.getJdbcMapping().getSqlTypeDescriptor() );
|
||||
return super.getRawTypeName( type.getJdbcMapping().getJdbcTypeDescriptor() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,8 +26,8 @@ import org.hibernate.sql.ast.SqlAstTranslatorFactory;
|
|||
import org.hibernate.sql.ast.spi.StandardSqlAstTranslatorFactory;
|
||||
import org.hibernate.sql.ast.tree.Statement;
|
||||
import org.hibernate.sql.exec.spi.JdbcOperation;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.TinyIntTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.TinyIntTypeDescriptor;
|
||||
|
||||
import java.sql.Types;
|
||||
import java.util.Map;
|
||||
|
@ -100,7 +100,7 @@ public class SybaseASEDialect extends SybaseDialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
|
||||
protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
|
||||
return sqlCode == Types.BOOLEAN
|
||||
? TinyIntTypeDescriptor.INSTANCE
|
||||
: super.getSqlTypeDescriptorOverride( sqlCode );
|
||||
|
|
|
@ -16,10 +16,10 @@ import org.hibernate.sql.ast.SqlAstTranslatorFactory;
|
|||
import org.hibernate.sql.ast.spi.StandardSqlAstTranslatorFactory;
|
||||
import org.hibernate.sql.ast.tree.Statement;
|
||||
import org.hibernate.sql.exec.spi.JdbcOperation;
|
||||
import org.hibernate.type.descriptor.sql.BlobTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.ClobTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry;
|
||||
import org.hibernate.type.descriptor.jdbc.BlobTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.ClobTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
|
||||
|
||||
import java.sql.Types;
|
||||
import javax.persistence.TemporalType;
|
||||
|
@ -53,19 +53,19 @@ public class SybaseDialect extends AbstractTransactSQLDialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor resolveSqlTypeDescriptor(
|
||||
public JdbcTypeDescriptor resolveSqlTypeDescriptor(
|
||||
int jdbcTypeCode,
|
||||
int precision,
|
||||
int scale,
|
||||
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) {
|
||||
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
|
||||
switch ( jdbcTypeCode ) {
|
||||
case Types.NUMERIC:
|
||||
case Types.DECIMAL:
|
||||
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
|
||||
|
@ -90,7 +90,7 @@ public class SybaseDialect extends AbstractTransactSQLDialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
|
||||
protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
|
||||
switch (sqlCode) {
|
||||
case Types.BLOB:
|
||||
return BlobTypeDescriptor.PRIMITIVE_ARRAY_BINDING;
|
||||
|
|
|
@ -43,8 +43,8 @@ import org.hibernate.sql.exec.spi.JdbcOperation;
|
|||
import org.hibernate.tool.schema.internal.StandardIndexExporter;
|
||||
import org.hibernate.tool.schema.spi.Exporter;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.ResultSet;
|
||||
|
@ -123,21 +123,21 @@ public class TeradataDialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor resolveSqlTypeDescriptor(
|
||||
public JdbcTypeDescriptor resolveSqlTypeDescriptor(
|
||||
int jdbcTypeCode,
|
||||
int precision,
|
||||
int scale,
|
||||
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) {
|
||||
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
|
||||
switch ( jdbcTypeCode ) {
|
||||
case Types.BIT:
|
||||
return sqlTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
|
||||
return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
|
||||
case Types.NUMERIC:
|
||||
case Types.DECIMAL:
|
||||
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
|
||||
|
|
|
@ -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.spi.SequenceInformationExtractor;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
|
||||
|
||||
import java.sql.Types;
|
||||
import javax.persistence.TemporalType;
|
||||
|
@ -98,15 +98,15 @@ public class TimesTenDialect extends Dialect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor resolveSqlTypeDescriptor(
|
||||
public JdbcTypeDescriptor resolveSqlTypeDescriptor(
|
||||
int jdbcTypeCode,
|
||||
int precision,
|
||||
int scale,
|
||||
SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry) {
|
||||
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
|
||||
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
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.util.TimeZone;
|
|||
|
||||
import org.hibernate.engine.jdbc.LobCreator;
|
||||
import org.hibernate.type.descriptor.WrapperOptions;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
|
||||
/**
|
||||
* @author Christian Beikov
|
||||
|
@ -34,8 +34,8 @@ public abstract class AbstractDelegatingWrapperOptions implements WrapperOptions
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
|
||||
return delegate().remapSqlTypeDescriptor( sqlTypeDescriptor );
|
||||
public JdbcTypeDescriptor remapSqlTypeDescriptor(JdbcTypeDescriptor jdbcTypeDescriptor) {
|
||||
return delegate().remapSqlTypeDescriptor( jdbcTypeDescriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -60,7 +60,7 @@ import org.hibernate.query.sql.spi.NativeQueryImplementor;
|
|||
import org.hibernate.resource.jdbc.spi.JdbcSessionContext;
|
||||
import org.hibernate.resource.transaction.spi.TransactionCoordinator;
|
||||
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.
|
||||
|
@ -1101,8 +1101,8 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
|
||||
return delegate.remapSqlTypeDescriptor( sqlTypeDescriptor );
|
||||
public JdbcTypeDescriptor remapSqlTypeDescriptor(JdbcTypeDescriptor jdbcTypeDescriptor) {
|
||||
return delegate.remapSqlTypeDescriptor( jdbcTypeDescriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.hibernate.FlushMode;
|
|||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Interceptor;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.MultiTenancyStrategy;
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
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.spi.TransactionCoordinator;
|
||||
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
|
||||
|
@ -581,8 +580,8 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
|
||||
return fastSessionServices.remapSqlTypeDescriptor( sqlTypeDescriptor );
|
||||
public JdbcTypeDescriptor remapSqlTypeDescriptor(JdbcTypeDescriptor jdbcTypeDescriptor) {
|
||||
return fastSessionServices.remapSqlTypeDescriptor( jdbcTypeDescriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -66,7 +66,7 @@ import org.hibernate.jpa.internal.util.ConfigurationHelper;
|
|||
import org.hibernate.jpa.internal.util.LockOptionsHelper;
|
||||
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
|
||||
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_TIMEOUT;
|
||||
|
@ -248,13 +248,13 @@ public final class FastSessionServices {
|
|||
return elr.getEventListenerGroup( type );
|
||||
}
|
||||
|
||||
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
|
||||
if ( !sqlTypeDescriptor.canBeRemapped() ) {
|
||||
return sqlTypeDescriptor;
|
||||
public JdbcTypeDescriptor remapSqlTypeDescriptor(JdbcTypeDescriptor jdbcTypeDescriptor) {
|
||||
if ( !jdbcTypeDescriptor.canBeRemapped() ) {
|
||||
return jdbcTypeDescriptor;
|
||||
}
|
||||
|
||||
final SqlTypeDescriptor remapped = dialect.remapSqlTypeDescriptor( sqlTypeDescriptor );
|
||||
return remapped == null ? sqlTypeDescriptor : remapped;
|
||||
final JdbcTypeDescriptor remapped = dialect.remapSqlTypeDescriptor( jdbcTypeDescriptor );
|
||||
return remapped == null ? jdbcTypeDescriptor : remapped;
|
||||
}
|
||||
|
||||
private static boolean isTransactionAccessible(SessionFactoryImpl sf, TransactionCoordinatorBuilder transactionCoordinatorBuilder) {
|
||||
|
|
|
@ -44,15 +44,15 @@ import org.hibernate.type.descriptor.java.EnumJavaTypeDescriptor;
|
|||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
||||
import org.hibernate.type.descriptor.java.TemporalJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@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 final TypeConfiguration typeConfiguration;
|
||||
|
@ -65,7 +65,7 @@ public class BasicValue extends SimpleValue implements SqlTypeDescriptorIndicato
|
|||
private Map explicitLocalTypeParams;
|
||||
|
||||
private Function<TypeConfiguration, BasicJavaDescriptor> explicitJavaTypeAccess;
|
||||
private Function<TypeConfiguration, SqlTypeDescriptor> explicitSqlTypeAccess;
|
||||
private Function<TypeConfiguration, JdbcTypeDescriptor> explicitSqlTypeAccess;
|
||||
private Function<TypeConfiguration, MutabilityPlan> explicitMutabilityPlanAccess;
|
||||
private Function<TypeConfiguration, java.lang.reflect.Type> implicitJavaTypeAccess;
|
||||
|
||||
|
@ -132,7 +132,7 @@ public class BasicValue extends SimpleValue implements SqlTypeDescriptorIndicato
|
|||
this.explicitJavaTypeAccess = explicitJavaTypeAccess;
|
||||
}
|
||||
|
||||
public void setExplicitSqlTypeAccess(Function<TypeConfiguration, SqlTypeDescriptor> sqlTypeAccess) {
|
||||
public void setExplicitSqlTypeAccess(Function<TypeConfiguration, JdbcTypeDescriptor> sqlTypeAccess) {
|
||||
this.explicitSqlTypeAccess = sqlTypeAccess;
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ public class BasicValue extends SimpleValue implements SqlTypeDescriptorIndicato
|
|||
if ( column instanceof Column && resolution.getValueConverter() == null ) {
|
||||
final Column physicalColumn = (Column) column;
|
||||
if ( physicalColumn.getSqlTypeCode() == null ) {
|
||||
physicalColumn.setSqlTypeCode( resolution.getRelationalSqlTypeDescriptor().getJdbcTypeCode() );
|
||||
physicalColumn.setSqlTypeCode( resolution.getJdbcTypeDescriptor().getJdbcTypeCode() );
|
||||
}
|
||||
|
||||
final BasicType<?> basicType = resolution.getLegacyResolvedBasicType();
|
||||
|
@ -265,7 +265,7 @@ public class BasicValue extends SimpleValue implements SqlTypeDescriptorIndicato
|
|||
physicalColumn.setCheckConstraint(
|
||||
basicType.getJavaTypeDescriptor().getCheckCondition(
|
||||
physicalColumn.getQuotedName( dialect ),
|
||||
basicType.getSqlTypeDescriptor(),
|
||||
basicType.getJdbcTypeDescriptor(),
|
||||
dialect
|
||||
)
|
||||
);
|
||||
|
@ -443,11 +443,11 @@ public class BasicValue extends SimpleValue implements SqlTypeDescriptorIndicato
|
|||
EnumType enumerationStyle,
|
||||
Function<TypeConfiguration, java.lang.reflect.Type> implicitJavaTypeAccess,
|
||||
Function<TypeConfiguration, BasicJavaDescriptor> explicitJtdAccess,
|
||||
Function<TypeConfiguration, SqlTypeDescriptor> explicitStdAccess,
|
||||
Function<TypeConfiguration, JdbcTypeDescriptor> explicitStdAccess,
|
||||
Function<TypeConfiguration, MutabilityPlan> explicitMutabilityPlanAccess,
|
||||
ConverterDescriptor converterDescriptor,
|
||||
Map localTypeParams,
|
||||
SqlTypeDescriptorIndicators stdIndicators,
|
||||
JdbcTypeDescriptorIndicators stdIndicators,
|
||||
TypeConfiguration typeConfiguration,
|
||||
MetadataBuildingContext context) {
|
||||
|
||||
|
@ -666,7 +666,7 @@ public class BasicValue extends SimpleValue implements SqlTypeDescriptorIndicato
|
|||
* The JavaTypeDescriptor for the relational value as part of
|
||||
* the relational model (its JDBC representation)
|
||||
*/
|
||||
SqlTypeDescriptor getRelationalSqlTypeDescriptor();
|
||||
JdbcTypeDescriptor getJdbcTypeDescriptor();
|
||||
|
||||
/**
|
||||
* Converter, if any, to convert values between the
|
||||
|
|
|
@ -268,7 +268,7 @@ public class Column implements Selectable, Serializable, Cloneable {
|
|||
type = getTypeForComponentValue( mapping, type, getTypeIndex() );
|
||||
}
|
||||
return dialect.getSizeStrategy().resolveSize(
|
||||
( (JdbcMapping) type ).getSqlTypeDescriptor(),
|
||||
( (JdbcMapping) type ).getJdbcTypeDescriptor(),
|
||||
( (JdbcMapping) type ).getJavaTypeDescriptor(),
|
||||
precision,
|
||||
scale,
|
||||
|
|
|
@ -47,12 +47,12 @@ import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
|
|||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.type.Type;
|
||||
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.java.BasicJavaDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.LobTypeMappings;
|
||||
import org.hibernate.type.descriptor.sql.NationalizedTypeMappings;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.LobTypeMappings;
|
||||
import org.hibernate.type.descriptor.jdbc.NationalizedTypeMappings;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
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
|
||||
// of ResultSets). See JdbcTypeJavaClassMappings for details. Again, given example, this should return
|
||||
// VARCHAR/CHAR
|
||||
final SqlTypeDescriptor recommendedSqlType = jpaAttributeConverter.getRelationalJavaTypeDescriptor().getJdbcRecommendedSqlType(
|
||||
final JdbcTypeDescriptor recommendedJdbcType = jpaAttributeConverter.getRelationalJavaTypeDescriptor().getRecommendedJdbcType(
|
||||
// todo (6.0) : handle the other JdbcRecommendedSqlTypeMappingContext methods
|
||||
metadata::getTypeConfiguration
|
||||
);
|
||||
int jdbcTypeCode = recommendedSqlType.getSqlType();
|
||||
int jdbcTypeCode = recommendedJdbcType.getJdbcType();
|
||||
if ( isLob() ) {
|
||||
if ( LobTypeMappings.isMappedToKnownLobCode( 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!)
|
||||
final SqlTypeDescriptor sqlTypeDescriptor = getMetadata()
|
||||
final JdbcTypeDescriptor jdbcTypeDescriptor = getMetadata()
|
||||
.getMetadataBuildingOptions()
|
||||
.getServiceRegistry()
|
||||
.getService( JdbcServices.class )
|
||||
|
@ -665,14 +665,14 @@ public abstract class SimpleValue implements KeyValue {
|
|||
.getDialect()
|
||||
.remapSqlTypeDescriptor(
|
||||
metadata.getTypeConfiguration()
|
||||
.getSqlTypeDescriptorRegistry()
|
||||
.getJdbcTypeDescriptorRegistry()
|
||||
.getDescriptor( jdbcTypeCode ) );
|
||||
|
||||
// and finally construct the adapter, which injects the AttributeConverter calls into the binding/extraction
|
||||
// process...
|
||||
final SqlTypeDescriptor sqlTypeDescriptorAdapter = new AttributeConverterSqlTypeDescriptorAdapter(
|
||||
final JdbcTypeDescriptor jdbcTypeDescriptorAdapter = new AttributeConverterJdbcTypeDescriptorAdapter(
|
||||
jpaAttributeConverter,
|
||||
sqlTypeDescriptor,
|
||||
jdbcTypeDescriptor,
|
||||
jpaAttributeConverter.getRelationalJavaTypeDescriptor()
|
||||
);
|
||||
|
||||
|
@ -688,7 +688,7 @@ public abstract class SimpleValue implements KeyValue {
|
|||
name,
|
||||
description,
|
||||
jpaAttributeConverter,
|
||||
sqlTypeDescriptorAdapter,
|
||||
jdbcTypeDescriptorAdapter,
|
||||
jpaAttributeConverter.getRelationalJavaTypeDescriptor(),
|
||||
jpaAttributeConverter.getDomainJavaTypeDescriptor(),
|
||||
null
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.hibernate.query.CastType;
|
|||
import org.hibernate.type.descriptor.ValueBinder;
|
||||
import org.hibernate.type.descriptor.ValueExtractor;
|
||||
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
|
||||
|
@ -28,10 +28,10 @@ public interface JdbcMapping extends MappingType {
|
|||
* The descriptor for the SQL type represented by this
|
||||
* expressable type
|
||||
*/
|
||||
SqlTypeDescriptor getSqlTypeDescriptor();
|
||||
JdbcTypeDescriptor getJdbcTypeDescriptor();
|
||||
|
||||
default CastType getCastType() {
|
||||
return getSqlTypeDescriptor().getCastType();
|
||||
return getJdbcTypeDescriptor().getCastType();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -370,7 +370,7 @@ public class MappingModelCreationHelper {
|
|||
.getBasicTypeRegistry()
|
||||
.resolve(
|
||||
valueConverter.getRelationalJavaDescriptor(),
|
||||
resolution.getRelationalSqlTypeDescriptor()
|
||||
resolution.getJdbcTypeDescriptor()
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import java.io.ObjectInputStream;
|
|||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.Locale;
|
||||
|
||||
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.java.EnumJavaTypeDescriptor;
|
||||
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
|
||||
|
@ -30,7 +29,7 @@ import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
|||
*/
|
||||
public class NamedEnumValueConverter<E extends Enum<E>> implements EnumValueConverter<E,String>, Serializable {
|
||||
private final EnumJavaTypeDescriptor<E> domainTypeDescriptor;
|
||||
private final SqlTypeDescriptor sqlTypeDescriptor;
|
||||
private final JdbcTypeDescriptor jdbcTypeDescriptor;
|
||||
private final JavaTypeDescriptor<String> relationalTypeDescriptor;
|
||||
|
||||
private transient ValueExtractor<String> valueExtractor;
|
||||
|
@ -38,14 +37,14 @@ public class NamedEnumValueConverter<E extends Enum<E>> implements EnumValueConv
|
|||
|
||||
public NamedEnumValueConverter(
|
||||
EnumJavaTypeDescriptor<E> domainTypeDescriptor,
|
||||
SqlTypeDescriptor sqlTypeDescriptor,
|
||||
JdbcTypeDescriptor jdbcTypeDescriptor,
|
||||
JavaTypeDescriptor<String> relationalTypeDescriptor) {
|
||||
this.domainTypeDescriptor = domainTypeDescriptor;
|
||||
this.sqlTypeDescriptor = sqlTypeDescriptor;
|
||||
this.jdbcTypeDescriptor = jdbcTypeDescriptor;
|
||||
this.relationalTypeDescriptor = relationalTypeDescriptor;
|
||||
|
||||
this.valueExtractor = sqlTypeDescriptor.getExtractor( relationalTypeDescriptor );
|
||||
this.valueBinder = sqlTypeDescriptor.getBinder( relationalTypeDescriptor );
|
||||
this.valueExtractor = jdbcTypeDescriptor.getExtractor( relationalTypeDescriptor );
|
||||
this.valueBinder = jdbcTypeDescriptor.getBinder( relationalTypeDescriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,7 +69,7 @@ public class NamedEnumValueConverter<E extends Enum<E>> implements EnumValueConv
|
|||
|
||||
@Override
|
||||
public int getJdbcTypeCode() {
|
||||
return sqlTypeDescriptor.getJdbcTypeCode();
|
||||
return jdbcTypeDescriptor.getJdbcTypeCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -82,8 +81,8 @@ public class NamedEnumValueConverter<E extends Enum<E>> implements EnumValueConv
|
|||
private void readObject(ObjectInputStream stream) throws ClassNotFoundException, IOException {
|
||||
stream.defaultReadObject();
|
||||
|
||||
this.valueExtractor = sqlTypeDescriptor.getExtractor( relationalTypeDescriptor );
|
||||
this.valueBinder = sqlTypeDescriptor.getBinder( relationalTypeDescriptor );
|
||||
this.valueExtractor = jdbcTypeDescriptor.getExtractor( relationalTypeDescriptor );
|
||||
this.valueBinder = jdbcTypeDescriptor.getBinder( relationalTypeDescriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,7 +19,7 @@ import org.hibernate.type.descriptor.ValueBinder;
|
|||
import org.hibernate.type.descriptor.ValueExtractor;
|
||||
import org.hibernate.type.descriptor.java.EnumJavaTypeDescriptor;
|
||||
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
|
||||
|
@ -30,7 +30,7 @@ import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
|||
public class OrdinalEnumValueConverter<E extends Enum<E>> implements EnumValueConverter<E,Integer>, Serializable {
|
||||
|
||||
private final EnumJavaTypeDescriptor<E> enumJavaDescriptor;
|
||||
private final SqlTypeDescriptor sqlTypeDescriptor;
|
||||
private final JdbcTypeDescriptor jdbcTypeDescriptor;
|
||||
private final JavaTypeDescriptor<Integer> relationalJavaDescriptor;
|
||||
|
||||
private transient ValueExtractor<Integer> valueExtractor;
|
||||
|
@ -38,14 +38,14 @@ public class OrdinalEnumValueConverter<E extends Enum<E>> implements EnumValueCo
|
|||
|
||||
public OrdinalEnumValueConverter(
|
||||
EnumJavaTypeDescriptor<E> enumJavaDescriptor,
|
||||
SqlTypeDescriptor sqlTypeDescriptor,
|
||||
JdbcTypeDescriptor jdbcTypeDescriptor,
|
||||
JavaTypeDescriptor<Integer> relationalJavaDescriptor) {
|
||||
this.enumJavaDescriptor = enumJavaDescriptor;
|
||||
this.sqlTypeDescriptor = sqlTypeDescriptor;
|
||||
this.jdbcTypeDescriptor = jdbcTypeDescriptor;
|
||||
this.relationalJavaDescriptor = relationalJavaDescriptor;
|
||||
|
||||
this.valueExtractor = sqlTypeDescriptor.getExtractor( relationalJavaDescriptor );
|
||||
this.valueBinder = sqlTypeDescriptor.getBinder( relationalJavaDescriptor );
|
||||
this.valueExtractor = jdbcTypeDescriptor.getExtractor( relationalJavaDescriptor );
|
||||
this.valueBinder = jdbcTypeDescriptor.getBinder( relationalJavaDescriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -85,8 +85,8 @@ public class OrdinalEnumValueConverter<E extends Enum<E>> implements EnumValueCo
|
|||
private void readObject(ObjectInputStream stream) throws ClassNotFoundException, IOException {
|
||||
stream.defaultReadObject();
|
||||
|
||||
this.valueExtractor = sqlTypeDescriptor.getExtractor( relationalJavaDescriptor );
|
||||
this.valueBinder = sqlTypeDescriptor.getBinder( relationalJavaDescriptor );
|
||||
this.valueExtractor = jdbcTypeDescriptor.getExtractor( relationalJavaDescriptor );
|
||||
this.valueBinder = jdbcTypeDescriptor.getBinder( relationalJavaDescriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,13 +10,13 @@ import java.sql.CallableStatement;
|
|||
import java.sql.SQLException;
|
||||
|
||||
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
|
||||
* 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
|
||||
*/
|
||||
|
@ -31,7 +31,7 @@ public interface AllowableOutputParameterType<J> extends AllowableParameterType<
|
|||
/**
|
||||
* Descriptor for the SQL type mapped by this type.
|
||||
*/
|
||||
SqlTypeDescriptor getSqlTypeDescriptor();
|
||||
JdbcTypeDescriptor getJdbcTypeDescriptor();
|
||||
|
||||
/**
|
||||
* Perform the extraction
|
||||
|
|
|
@ -14,7 +14,7 @@ import org.hibernate.NotYetImplementedFor6Exception;
|
|||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.metamodel.model.domain.BasicDomainType;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
|
@ -45,7 +45,7 @@ public class BasicTypeImpl<J> implements BasicDomainType<J>, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor getSqlTypeDescriptor() {
|
||||
public JdbcTypeDescriptor getJdbcTypeDescriptor() {
|
||||
throw new NotYetImplementedFor6Exception( getClass() );
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public class FunctionReturnImpl implements FunctionReturnImplementor {
|
|||
|
||||
public FunctionReturnImpl(ProcedureCallImplementor procedureCall, AllowableOutputParameterType ormType) {
|
||||
this.procedureCall = procedureCall;
|
||||
this.jdbcTypeCode = ormType.getSqlTypeDescriptor().getSqlType();
|
||||
this.jdbcTypeCode = ormType.getJdbcTypeDescriptor().getJdbcType();
|
||||
|
||||
this.ormType = ormType;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public class TempIdTableExporter implements IdTableExporter {
|
|||
}
|
||||
|
||||
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 );
|
||||
|
||||
buffer.append( " " ).append( databaseTypeName ).append( " " );
|
||||
|
|
|
@ -137,8 +137,8 @@ public class StandardFunctionReturnTypeResolvers {
|
|||
//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
|
||||
//both numeric types.
|
||||
int impliedTypeCode = ((BasicType<?>) implied).getJdbcMapping().getSqlTypeDescriptor().getJdbcTypeCode();
|
||||
int definedTypeCode = ((BasicType<?>) defined).getJdbcMapping().getSqlTypeDescriptor().getJdbcTypeCode();
|
||||
int impliedTypeCode = ((BasicType<?>) implied).getJdbcMapping().getJdbcTypeDescriptor().getJdbcTypeCode();
|
||||
int definedTypeCode = ((BasicType<?>) defined).getJdbcMapping().getJdbcTypeDescriptor().getJdbcTypeCode();
|
||||
return impliedTypeCode == 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
|
||||
//the types are compatible if the map to the same JDBC type, of if they are
|
||||
//both numeric types.
|
||||
int impliedTypeCode = implied.getJdbcMapping().getSqlTypeDescriptor().getJdbcTypeCode();
|
||||
int definedTypeCode = defined.getJdbcMapping().getSqlTypeDescriptor().getJdbcTypeCode();
|
||||
int impliedTypeCode = implied.getJdbcMapping().getJdbcTypeDescriptor().getJdbcTypeCode();
|
||||
int definedTypeCode = defined.getJdbcMapping().getJdbcTypeDescriptor().getJdbcTypeCode();
|
||||
return impliedTypeCode == definedTypeCode
|
||||
|| isNumeric( impliedTypeCode ) && isNumeric( definedTypeCode );
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ import org.hibernate.sql.results.internal.StandardEntityGraphTraversalStateImpl;
|
|||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
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.jboss.logging.Logger;
|
||||
|
@ -293,7 +293,7 @@ import static org.hibernate.type.spi.TypeConfiguration.isDuration;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
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 );
|
||||
|
||||
|
|
|
@ -141,8 +141,8 @@ import org.hibernate.sql.results.jdbc.internal.JdbcValuesMappingProducerStandard
|
|||
import org.hibernate.type.IntegerType;
|
||||
import org.hibernate.type.StringType;
|
||||
import org.hibernate.type.descriptor.WrapperOptions;
|
||||
import org.hibernate.type.descriptor.sql.JdbcLiteralFormatter;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcLiteralFormatter;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
|
||||
import static org.hibernate.query.TemporalUnit.NANOSECOND;
|
||||
import static org.hibernate.sql.ast.SqlTreePrinter.logSqlAst;
|
||||
|
@ -261,8 +261,8 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
|
||||
return sessionFactory.getFastSessionServices().remapSqlTypeDescriptor( sqlTypeDescriptor );
|
||||
public JdbcTypeDescriptor remapSqlTypeDescriptor(JdbcTypeDescriptor jdbcTypeDescriptor) {
|
||||
return sessionFactory.getFastSessionServices().remapSqlTypeDescriptor( jdbcTypeDescriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2442,7 +2442,7 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
|
|||
|
||||
final JdbcMapping jdbcMapping = literal.getJdbcMapping();
|
||||
final JdbcLiteralFormatter literalFormatter = jdbcMapping
|
||||
.getSqlTypeDescriptor()
|
||||
.getJdbcTypeDescriptor()
|
||||
.getJdbcLiteralFormatter( jdbcMapping.getJavaTypeDescriptor() );
|
||||
|
||||
// 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 );
|
||||
// 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
|
||||
if ( jdbcMapping.getSqlTypeDescriptor().isNumber() ) {
|
||||
if ( jdbcMapping.getJdbcTypeDescriptor().isNumber() ) {
|
||||
appendSql( '(' );
|
||||
sqlAstNode.accept( this );
|
||||
appendSql( "+0)" );
|
||||
break;
|
||||
}
|
||||
else if ( jdbcMapping.getSqlTypeDescriptor().isString() ) {
|
||||
else if ( jdbcMapping.getJdbcTypeDescriptor().isString() ) {
|
||||
final SqmFunctionDescriptor sqmFunctionDescriptor = getSessionFactory().getQueryEngine()
|
||||
.getSqmFunctionRegistry()
|
||||
.findFunctionDescriptor( "concat" );
|
||||
|
@ -3253,7 +3253,7 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
|
|||
else {
|
||||
assert jdbcParameter.getExpressionType().getJdbcTypeCount() == 1;
|
||||
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 ) {
|
||||
throw new IllegalArgumentException( "Can't render parameter as literal, no literal formatter found" );
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
|
|||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||
import org.hibernate.type.BasicType;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -73,23 +73,23 @@ public interface ResultSetAccess extends JdbcValuesMetadata {
|
|||
try {
|
||||
final TypeConfiguration typeConfiguration = getFactory().getTypeConfiguration();
|
||||
final ResultSetMetaData metaData = getResultSet().getMetaData();
|
||||
final SqlTypeDescriptor sqlTypeDescriptor = jdbcServices.getDialect()
|
||||
final JdbcTypeDescriptor jdbcTypeDescriptor = jdbcServices.getDialect()
|
||||
.resolveSqlTypeDescriptor(
|
||||
metaData.getColumnType( position ),
|
||||
metaData.getPrecision( position ),
|
||||
metaData.getScale( position ),
|
||||
typeConfiguration.getSqlTypeDescriptorRegistry()
|
||||
typeConfiguration.getJdbcTypeDescriptorRegistry()
|
||||
);
|
||||
final JavaTypeDescriptor<J> javaTypeDescriptor;
|
||||
if ( explicitJavaTypeDescriptor == null ) {
|
||||
javaTypeDescriptor = sqlTypeDescriptor.getJdbcRecommendedJavaTypeMapping( typeConfiguration );
|
||||
javaTypeDescriptor = jdbcTypeDescriptor.getJdbcRecommendedJavaTypeMapping( typeConfiguration );
|
||||
}
|
||||
else {
|
||||
javaTypeDescriptor = explicitJavaTypeDescriptor;
|
||||
}
|
||||
return typeConfiguration.getBasicTypeRegistry().resolve(
|
||||
javaTypeDescriptor,
|
||||
sqlTypeDescriptor
|
||||
jdbcTypeDescriptor
|
||||
);
|
||||
}
|
||||
catch (SQLException e) {
|
||||
|
|
|
@ -8,8 +8,6 @@ package org.hibernate.sql.results.jdbc.spi;
|
|||
|
||||
import org.hibernate.type.BasicType;
|
||||
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
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.sql.SQLException;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
|
||||
/**
|
||||
* TODO : javadoc
|
||||
|
@ -23,13 +23,13 @@ public abstract class AbstractSingleColumnStandardBasicType<T>
|
|||
extends AbstractStandardBasicType<T>
|
||||
implements SingleColumnType<T> {
|
||||
|
||||
public AbstractSingleColumnStandardBasicType(SqlTypeDescriptor sqlTypeDescriptor, JavaTypeDescriptor<T> javaTypeDescriptor) {
|
||||
super( sqlTypeDescriptor, javaTypeDescriptor );
|
||||
public AbstractSingleColumnStandardBasicType(JdbcTypeDescriptor jdbcTypeDescriptor, JavaTypeDescriptor<T> javaTypeDescriptor) {
|
||||
super( jdbcTypeDescriptor, javaTypeDescriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int sqlType() {
|
||||
return getSqlTypeDescriptor().getSqlType();
|
||||
return getJdbcTypeDescriptor().getJdbcType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.hibernate.type.descriptor.ValueExtractor;
|
|||
import org.hibernate.type.descriptor.WrapperOptions;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
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
|
||||
|
@ -44,7 +44,7 @@ public abstract class AbstractStandardBasicType<T>
|
|||
|
||||
// Don't use final here. Need to initialize after-the-fact
|
||||
// by DynamicParameterizedTypes.
|
||||
private SqlTypeDescriptor sqlTypeDescriptor;
|
||||
private JdbcTypeDescriptor jdbcTypeDescriptor;
|
||||
private JavaTypeDescriptor<T> javaTypeDescriptor;
|
||||
// sqlTypes need always to be in sync with sqlTypeDescriptor
|
||||
private int[] sqlTypes;
|
||||
|
@ -52,13 +52,13 @@ public abstract class AbstractStandardBasicType<T>
|
|||
private ValueBinder<T> jdbcValueBinder;
|
||||
private ValueExtractor<T> jdbcValueExtractor;
|
||||
|
||||
public AbstractStandardBasicType(SqlTypeDescriptor sqlTypeDescriptor, JavaTypeDescriptor<T> javaTypeDescriptor) {
|
||||
this.sqlTypeDescriptor = sqlTypeDescriptor;
|
||||
this.sqlTypes = new int[] { sqlTypeDescriptor.getSqlType() };
|
||||
public AbstractStandardBasicType(JdbcTypeDescriptor jdbcTypeDescriptor, JavaTypeDescriptor<T> javaTypeDescriptor) {
|
||||
this.jdbcTypeDescriptor = jdbcTypeDescriptor;
|
||||
this.sqlTypes = new int[] { jdbcTypeDescriptor.getJdbcType() };
|
||||
this.javaTypeDescriptor = javaTypeDescriptor;
|
||||
|
||||
this.jdbcValueBinder = sqlTypeDescriptor.getBinder( javaTypeDescriptor );
|
||||
this.jdbcValueExtractor = sqlTypeDescriptor.getExtractor( javaTypeDescriptor );
|
||||
this.jdbcValueBinder = jdbcTypeDescriptor.getBinder( javaTypeDescriptor );
|
||||
this.jdbcValueExtractor = jdbcTypeDescriptor.getExtractor( javaTypeDescriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -146,20 +146,20 @@ public abstract class AbstractStandardBasicType<T>
|
|||
public final void setJavaTypeDescriptor( JavaTypeDescriptor<T> javaTypeDescriptor ) {
|
||||
this.javaTypeDescriptor = javaTypeDescriptor;
|
||||
|
||||
this.jdbcValueBinder = getSqlTypeDescriptor().getBinder( javaTypeDescriptor );
|
||||
this.jdbcValueExtractor = getSqlTypeDescriptor().getExtractor( javaTypeDescriptor );
|
||||
this.jdbcValueBinder = getJdbcTypeDescriptor().getBinder( javaTypeDescriptor );
|
||||
this.jdbcValueExtractor = getJdbcTypeDescriptor().getExtractor( javaTypeDescriptor );
|
||||
}
|
||||
|
||||
public final SqlTypeDescriptor getSqlTypeDescriptor() {
|
||||
return sqlTypeDescriptor;
|
||||
public final JdbcTypeDescriptor getJdbcTypeDescriptor() {
|
||||
return jdbcTypeDescriptor;
|
||||
}
|
||||
|
||||
public final void setSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
|
||||
this.sqlTypeDescriptor = sqlTypeDescriptor;
|
||||
this.sqlTypes = new int[] { sqlTypeDescriptor.getSqlType() };
|
||||
public final void setSqlTypeDescriptor(JdbcTypeDescriptor jdbcTypeDescriptor) {
|
||||
this.jdbcTypeDescriptor = jdbcTypeDescriptor;
|
||||
this.sqlTypes = new int[] { jdbcTypeDescriptor.getJdbcType() };
|
||||
|
||||
this.jdbcValueBinder = getSqlTypeDescriptor().getBinder( javaTypeDescriptor );
|
||||
this.jdbcValueExtractor = getSqlTypeDescriptor().getExtractor( javaTypeDescriptor );
|
||||
this.jdbcValueBinder = getJdbcTypeDescriptor().getBinder( javaTypeDescriptor );
|
||||
this.jdbcValueExtractor = getJdbcTypeDescriptor().getExtractor( javaTypeDescriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -310,8 +310,8 @@ public abstract class AbstractStandardBasicType<T>
|
|||
remapSqlTypeDescriptor( options ).getBinder( javaTypeDescriptor ).bind( st, ( T ) value, index, options );
|
||||
}
|
||||
|
||||
protected SqlTypeDescriptor remapSqlTypeDescriptor(WrapperOptions options) {
|
||||
return options.remapSqlTypeDescriptor( sqlTypeDescriptor );
|
||||
protected JdbcTypeDescriptor remapSqlTypeDescriptor(WrapperOptions options) {
|
||||
return options.remapSqlTypeDescriptor( jdbcTypeDescriptor );
|
||||
}
|
||||
|
||||
public void set(PreparedStatement st, T value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
|
||||
|
|
|
@ -19,7 +19,7 @@ public class AdaptedImmutableType<T> extends AbstractSingleColumnStandardBasicTy
|
|||
private final AbstractStandardBasicType<T> baseMutableType;
|
||||
|
||||
public AdaptedImmutableType(AbstractStandardBasicType<T> baseMutableType) {
|
||||
super( baseMutableType.getSqlTypeDescriptor(), baseMutableType.getJavaTypeDescriptor() );
|
||||
super( baseMutableType.getJdbcTypeDescriptor(), baseMutableType.getJavaTypeDescriptor() );
|
||||
this.baseMutableType = baseMutableType;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,13 +53,13 @@ public interface BasicType<T> extends Type, BasicDomainType<T>, MappingType, Bas
|
|||
@Override
|
||||
default ValueExtractor getJdbcValueExtractor() {
|
||||
//noinspection unchecked
|
||||
return getSqlTypeDescriptor().getExtractor( getMappedJavaTypeDescriptor() );
|
||||
return getJdbcTypeDescriptor().getExtractor( getMappedJavaTypeDescriptor() );
|
||||
}
|
||||
|
||||
@Override
|
||||
default ValueBinder getJdbcValueBinder() {
|
||||
//noinspection unchecked
|
||||
return getSqlTypeDescriptor().getBinder( getMappedJavaTypeDescriptor() );
|
||||
return getJdbcTypeDescriptor().getBinder( getMappedJavaTypeDescriptor() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.hibernate.internal.CoreMessageLogger;
|
|||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||
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.spi.TypeConfiguration;
|
||||
import org.hibernate.usertype.UserType;
|
||||
|
@ -32,7 +32,7 @@ public class BasicTypeRegistry implements Serializable {
|
|||
|
||||
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 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
|
||||
* 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
|
||||
return resolve(
|
||||
jtdToUse,
|
||||
|
@ -74,7 +74,7 @@ public class BasicTypeRegistry implements Serializable {
|
|||
* Find an existing BasicType registration for the given JavaTypeDescriptor and
|
||||
* 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(
|
||||
stdToUse,
|
||||
sqlTypeDescriptor -> new ConcurrentHashMap<>()
|
||||
|
@ -118,7 +118,7 @@ public class BasicTypeRegistry implements Serializable {
|
|||
|
||||
private void applyOrOverwriteEntry(BasicType<?> type) {
|
||||
final Map<JavaTypeDescriptor<?>, BasicType<?>> mappingsForStdToUse = registryValues.computeIfAbsent(
|
||||
type.getSqlTypeDescriptor(),
|
||||
type.getJdbcTypeDescriptor(),
|
||||
sqlTypeDescriptor -> new ConcurrentHashMap<>()
|
||||
);
|
||||
|
||||
|
@ -126,7 +126,7 @@ public class BasicTypeRegistry implements Serializable {
|
|||
if ( existing != null ) {
|
||||
LOG.debugf(
|
||||
"BasicTypeRegistry registration overwritten (%s + %s); previous =`%s`",
|
||||
type.getSqlTypeDescriptor().getFriendlyName(),
|
||||
type.getJdbcTypeDescriptor().getFriendlyName(),
|
||||
type.getJavaTypeDescriptor(),
|
||||
existing
|
||||
);
|
||||
|
@ -184,7 +184,7 @@ public class BasicTypeRegistry implements Serializable {
|
|||
|
||||
private void primeRegistryEntry(BasicType<?> type) {
|
||||
final Map<JavaTypeDescriptor<?>, BasicType<?>> mappingsForStdToUse = registryValues.computeIfAbsent(
|
||||
type.getSqlTypeDescriptor(),
|
||||
type.getJdbcTypeDescriptor(),
|
||||
sqlTypeDescriptor -> new ConcurrentHashMap<>()
|
||||
);
|
||||
|
||||
|
@ -193,7 +193,7 @@ public class BasicTypeRegistry implements Serializable {
|
|||
if ( existing != null ) {
|
||||
LOG.debugf(
|
||||
"Skipping registration of BasicType (%s + %s); still priming. existing = %s",
|
||||
type.getSqlTypeDescriptor().getFriendlyName(),
|
||||
type.getJdbcTypeDescriptor().getFriendlyName(),
|
||||
type.getJavaTypeDescriptor(),
|
||||
existing
|
||||
);
|
||||
|
|
|
@ -9,7 +9,7 @@ package org.hibernate.type;
|
|||
import java.math.BigDecimal;
|
||||
|
||||
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}.
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.math.BigInteger;
|
|||
|
||||
import org.hibernate.dialect.Dialect;
|
||||
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}.
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.util.Comparator;
|
|||
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
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[]}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class BlobType extends AbstractSingleColumnStandardBasicType<Blob> {
|
|||
public static final BlobType INSTANCE = new BlobType();
|
||||
|
||||
public BlobType() {
|
||||
super( org.hibernate.type.descriptor.sql.BlobTypeDescriptor.DEFAULT, BlobTypeDescriptor.INSTANCE );
|
||||
super( org.hibernate.type.descriptor.jdbc.BlobTypeDescriptor.DEFAULT, BlobTypeDescriptor.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,8 +11,8 @@ import java.sql.Types;
|
|||
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.type.descriptor.java.BooleanTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
|
||||
|
||||
/**
|
||||
* 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 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) {
|
||||
super( sqlTypeDescriptor, javaTypeDescriptor );
|
||||
protected BooleanType(JdbcTypeDescriptor jdbcTypeDescriptor, BooleanTypeDescriptor javaTypeDescriptor) {
|
||||
super( jdbcTypeDescriptor, javaTypeDescriptor );
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
|
@ -60,25 +60,25 @@ public class BooleanType
|
|||
}
|
||||
|
||||
@Override
|
||||
public <X> BasicType<X> resolveIndicatedType(SqlTypeDescriptorIndicators indicators) {
|
||||
public <X> BasicType<X> resolveIndicatedType(JdbcTypeDescriptorIndicators indicators) {
|
||||
final int preferredSqlTypeCodeForBoolean = indicators.getPreferredSqlTypeCodeForBoolean();
|
||||
final SqlTypeDescriptor sqlTypeDescriptor;
|
||||
final JdbcTypeDescriptor jdbcTypeDescriptor;
|
||||
// We treat BIT like BOOLEAN because it uses the same JDBC access methods
|
||||
if ( preferredSqlTypeCodeForBoolean != Types.BIT && preferredSqlTypeCodeForBoolean != getSqlTypeDescriptor().getJdbcTypeCode() ) {
|
||||
sqlTypeDescriptor = indicators.getTypeConfiguration()
|
||||
.getSqlTypeDescriptorRegistry()
|
||||
if ( preferredSqlTypeCodeForBoolean != Types.BIT && preferredSqlTypeCodeForBoolean != getJdbcTypeDescriptor().getJdbcTypeCode() ) {
|
||||
jdbcTypeDescriptor = indicators.getTypeConfiguration()
|
||||
.getJdbcTypeDescriptorRegistry()
|
||||
.getDescriptor( preferredSqlTypeCodeForBoolean );
|
||||
}
|
||||
else {
|
||||
sqlTypeDescriptor = indicators.getTypeConfiguration()
|
||||
.getSqlTypeDescriptorRegistry()
|
||||
jdbcTypeDescriptor = indicators.getTypeConfiguration()
|
||||
.getJdbcTypeDescriptorRegistry()
|
||||
.getDescriptor( Types.BOOLEAN );
|
||||
}
|
||||
if ( sqlTypeDescriptor != getSqlTypeDescriptor() ) {
|
||||
if ( jdbcTypeDescriptor != getJdbcTypeDescriptor() ) {
|
||||
//noinspection unchecked
|
||||
return (BasicType<X>) indicators.getTypeConfiguration()
|
||||
.getBasicTypeRegistry()
|
||||
.resolve( getJavaTypeDescriptor(), sqlTypeDescriptor );
|
||||
.resolve( getJavaTypeDescriptor(), jdbcTypeDescriptor );
|
||||
}
|
||||
|
||||
//noinspection unchecked
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.util.Comparator;
|
|||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
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}
|
||||
|
|
|
@ -13,7 +13,7 @@ import javax.persistence.TemporalType;
|
|||
import org.hibernate.QueryException;
|
||||
import org.hibernate.metamodel.model.domain.AllowableTemporalParameterType;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,7 +13,7 @@ import javax.persistence.TemporalType;
|
|||
import org.hibernate.QueryException;
|
||||
import org.hibernate.metamodel.model.domain.AllowableTemporalParameterType;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,7 +16,7 @@ import org.hibernate.QueryException;
|
|||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.metamodel.model.domain.AllowableTemporalParameterType;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,9 +8,9 @@ package org.hibernate.type;
|
|||
import java.sql.Types;
|
||||
|
||||
import org.hibernate.type.descriptor.java.PrimitiveCharacterArrayTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.jdbc.VarcharTypeDescriptor;
|
||||
|
||||
/**
|
||||
* A type that maps between {@link java.sql.Types#VARCHAR VARCHAR} and {@code char[]}
|
||||
|
@ -37,15 +37,15 @@ public class CharArrayType
|
|||
}
|
||||
|
||||
@Override
|
||||
public <X> BasicType<X> resolveIndicatedType(SqlTypeDescriptorIndicators indicators) {
|
||||
public <X> BasicType<X> resolveIndicatedType(JdbcTypeDescriptorIndicators indicators) {
|
||||
if ( indicators.isLob() ) {
|
||||
//noinspection unchecked
|
||||
return (BasicType<X>) ( indicators.isNationalized() ? CharacterArrayNClobType.INSTANCE : CharacterArrayClobType.INSTANCE );
|
||||
}
|
||||
|
||||
if ( indicators.isNationalized() ) {
|
||||
final SqlTypeDescriptor nvarcharType = indicators.getTypeConfiguration()
|
||||
.getSqlTypeDescriptorRegistry()
|
||||
final JdbcTypeDescriptor nvarcharType = indicators.getTypeConfiguration()
|
||||
.getJdbcTypeDescriptorRegistry()
|
||||
.getDescriptor( Types.NVARCHAR );
|
||||
|
||||
//noinspection unchecked
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
package org.hibernate.type;
|
||||
|
||||
import org.hibernate.type.descriptor.java.CharacterArrayTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.ClobTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.jdbc.ClobTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
|
||||
|
||||
/**
|
||||
* A type that maps between {@link java.sql.Types#CLOB CLOB} and {@link Character Character[]}
|
||||
|
@ -33,7 +33,7 @@ public class CharacterArrayClobType
|
|||
}
|
||||
|
||||
@Override
|
||||
public <X> BasicType<X> resolveIndicatedType(SqlTypeDescriptorIndicators indicators) {
|
||||
public <X> BasicType<X> resolveIndicatedType(JdbcTypeDescriptorIndicators indicators) {
|
||||
//noinspection unchecked
|
||||
return (BasicType<X>) ( indicators.isNationalized() ? CharacterArrayNClobType.INSTANCE : this );
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
package org.hibernate.type;
|
||||
|
||||
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[]}
|
||||
|
|
|
@ -8,9 +8,9 @@ package org.hibernate.type;
|
|||
import java.sql.Types;
|
||||
|
||||
import org.hibernate.type.descriptor.java.CharacterArrayTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.jdbc.VarcharTypeDescriptor;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
/**
|
||||
|
@ -38,7 +38,7 @@ public class CharacterArrayType
|
|||
}
|
||||
|
||||
@Override
|
||||
public <X> BasicType<X> resolveIndicatedType(SqlTypeDescriptorIndicators indicators) {
|
||||
public <X> BasicType<X> resolveIndicatedType(JdbcTypeDescriptorIndicators indicators) {
|
||||
if ( indicators.isNationalized() ) {
|
||||
final TypeConfiguration typeConfiguration = indicators.getTypeConfiguration();
|
||||
if ( indicators.isLob() ) {
|
||||
|
@ -46,7 +46,7 @@ public class CharacterArrayType
|
|||
return (BasicType<X>) CharacterArrayNClobType.INSTANCE;
|
||||
}
|
||||
else {
|
||||
final SqlTypeDescriptor nvarcharType = typeConfiguration.getSqlTypeDescriptorRegistry().getDescriptor( Types.NVARCHAR );
|
||||
final JdbcTypeDescriptor nvarcharType = typeConfiguration.getJdbcTypeDescriptorRegistry().getDescriptor( Types.NVARCHAR );
|
||||
//noinspection unchecked
|
||||
return (BasicType<X>) typeConfiguration.getBasicTypeRegistry().resolve( getJavaTypeDescriptor(), nvarcharType );
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.io.Serializable;
|
|||
|
||||
import org.hibernate.dialect.Dialect;
|
||||
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}
|
||||
|
|
|
@ -10,8 +10,8 @@ import java.io.Serializable;
|
|||
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.type.descriptor.java.CharacterTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.CharTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
|
||||
import org.hibernate.type.descriptor.jdbc.CharTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
|
||||
|
||||
/**
|
||||
* A type that maps between {@link java.sql.Types#CHAR CHAR(1)} and {@link Character}
|
||||
|
@ -55,7 +55,7 @@ public class CharacterType
|
|||
}
|
||||
|
||||
@Override
|
||||
public <X> BasicType<X> resolveIndicatedType(SqlTypeDescriptorIndicators indicators) {
|
||||
public <X> BasicType<X> resolveIndicatedType(JdbcTypeDescriptorIndicators indicators) {
|
||||
return (BasicType<X>) ( indicators.isNationalized() ? CharacterNCharType.INSTANCE : this );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.type;
|
||||
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}
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.sql.Clob;
|
|||
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
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}
|
||||
|
@ -22,7 +22,7 @@ public class ClobType extends AbstractSingleColumnStandardBasicType<Clob> implem
|
|||
public static final ClobType INSTANCE = new ClobType();
|
||||
|
||||
public ClobType() {
|
||||
super( org.hibernate.type.descriptor.sql.ClobTypeDescriptor.DEFAULT, ClobTypeDescriptor.INSTANCE );
|
||||
super( org.hibernate.type.descriptor.jdbc.ClobTypeDescriptor.DEFAULT, ClobTypeDescriptor.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -42,7 +42,7 @@ public class ClobType extends AbstractSingleColumnStandardBasicType<Clob> implem
|
|||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@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
|
||||
// - might be especially interesting for streaming based (N)VARCHAR reading
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.hibernate.tuple.ValueGeneration;
|
|||
import org.hibernate.tuple.component.ComponentMetamodel;
|
||||
import org.hibernate.tuple.component.ComponentTuplizer;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -760,7 +760,7 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor getSqlTypeDescriptor() {
|
||||
public JdbcTypeDescriptor getJdbcTypeDescriptor() {
|
||||
throw new NotYetImplementedFor6Exception( getClass() );
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.util.Currency;
|
|||
|
||||
import org.hibernate.dialect.Dialect;
|
||||
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}
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
|
|||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
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.usertype.EnhancedUserType;
|
||||
import org.hibernate.usertype.LoggableUserType;
|
||||
|
@ -56,7 +56,7 @@ public class CustomType
|
|||
private final String name;
|
||||
|
||||
private final JavaTypeDescriptor mappedJavaTypeDescriptor;
|
||||
private final SqlTypeDescriptor sqlTypeDescriptor;
|
||||
private final JdbcTypeDescriptor jdbcTypeDescriptor;
|
||||
|
||||
private final Size dictatedSize;
|
||||
private final Size defaultSize;
|
||||
|
@ -73,7 +73,7 @@ public class CustomType
|
|||
|
||||
//noinspection unchecked
|
||||
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 ) {
|
||||
final Sized sized = (Sized) userType;
|
||||
|
@ -94,13 +94,13 @@ public class CustomType
|
|||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor getSqlTypeDescriptor() {
|
||||
return sqlTypeDescriptor;
|
||||
public JdbcTypeDescriptor getJdbcTypeDescriptor() {
|
||||
return jdbcTypeDescriptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] sqlTypes(Mapping pi) {
|
||||
return new int[] { sqlTypeDescriptor.getSqlType() };
|
||||
return new int[] { jdbcTypeDescriptor.getJdbcType() };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,7 +29,7 @@ public class DateType
|
|||
public static final DateType INSTANCE = new 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() {
|
||||
|
|
|
@ -23,7 +23,7 @@ public class DoubleType extends AbstractSingleColumnStandardBasicType<Double> im
|
|||
public static final Double ZERO = 0.0;
|
||||
|
||||
public DoubleType() {
|
||||
super( org.hibernate.type.descriptor.sql.FloatTypeDescriptor.INSTANCE, DoubleTypeDescriptor.INSTANCE );
|
||||
super( org.hibernate.type.descriptor.jdbc.FloatTypeDescriptor.INSTANCE, DoubleTypeDescriptor.INSTANCE );
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue