more user-guide basic-type chapter work;

renamed `JavaTypeDescriptorRegistry` to `JavaTypeRegistry`;
renamed `JdbcTypeDescriptorRegistry` to `JdbcTypeRegistry`
This commit is contained in:
Steve Ebersole 2021-10-25 13:55:34 -05:00
parent 3c26c470b0
commit 0925e48ebf
80 changed files with 463 additions and 264 deletions

View File

@ -1298,25 +1298,180 @@ For details, see the discussion of generators in <<chapters/domain/identifiers.a
==== Compositional basic mapping
The compositional approach allows defining how the mapping should work in terms of influencing
individual, basic-valued parts of the model:
individual parts that make up a basic-value mapping. This section will look at these individual
parts and the specifics of influencing each.
`JavaTypeDescriptor`:: Describes capabilities of the Java type as discussed in <<basic>>. The descriptor
used can be influenced through `@JavaType` and `@JavaTypeRegistration`. `@JavaTypeRegistration` is a global
form of `@JavaType`.
`JdbcTypeDescriptor`:: Describes aspects of the JDBC type such as how to bind and extract values. The descriptor
used can be influenced through `@JdbcType`, `@JdbcTypeCode` and `@JdbcTypeRegistration`.
`@JdbcTypeRegistration` is a global form of `@JdbcType` / `@JdbcTypeCode`.
`BasicValueConverter`:: Describes the conversions that need to occur when reading from or writing to the database.
Some Java types (enums, e.g.) have an implicit conversion. Users can specify an explicit conversion using
`AttributeConverter`. See <<basic-jpa-convert>>.
`MutabilityPlan`:: Describes whether the internal state of values of the type are mutable or immutable.
`MutabilityPlan` can be influenced by `@Mutability` or `@Immutable`
When using the compositional approach, there are other ways to influence the resolution are covered
[[basic-mapping-composition-java]]
===== JavaType
Hibernate needs to understand certain aspects of the Java type to handle values properly and efficiently.
Hibernate understands these capabilities through its `org.hibernate.type.descriptor.java.JavaType` contract.
Hibernate provides built-in support for many JDK types (`Integer`, `String`, e.g.), but also supports the ability
for the application to change the handling for any of the standard `JavaType` registrations as well as
add in handling for non-standard types. Hibernate provides multiple ways for the application to influence
the `JavaType` descriptor to use.
The resolution can be influenced locally using the `@JavaType` annotation on a particular mapping. The
indicated descriptor will be used just for that mapping. There are also forms of `@JavaType` for influencing
the keys of a Map (`@MapKeyJavaType`), the index of a List or array (`@ListIndexJavaType`), the identifier
of an ID-BAG mapping (`@CollectionIdJavaType`) as well as the discriminator (`@AnyDiscriminator`) and
key (`@AnyKeyJavaClass`, `@AnyKeyJavaType`) of an ANY mapping.
The resolution can also be influenced globally by registering the appropriate `JavaType` descriptor with the
`JavaTypeRegistry`. This approach is able to both "override" the handling for certain Java types or
to register new types. See <<basic-mapping-registries>> for discussion of `JavaTypeRegistry`.
See <<basic-mapping-composition-resolution>> for a discussion of the process used to resolve the
mapping composition.
[[basic-mapping-composition-jdbc]]
===== JdbcType
Hibernate also needs to understand aspects of the JDBC type it should use (how it should bind values,
how it should extract values, etc.) which is the role of its `org.hibernate.type.descriptor.jdbc.JdbcType`
contract. Hibernate provides multiple ways for the application to influence the `JdbcType` descriptor to use.
Locally, the resolution can be influenced using either the `@JdbcType` or `@JdbcTypeCode` annotations. There
are also annotations for influencing the `JdbcType` in relation to Map keys (`@MapKeyJdbcType`, `@MapKeyJdbcTypeCode`),
the index of a List or array (`@ListIndexJdbcType`, `@ListIndexJdbcTypeCode`), the identifier of an ID-BAG mapping
(`@CollectionIdJdbcType`, `@CollectionIdJdbcTypeCode`) as well as the key of an ANY mapping (`@AnyKeyJdbcType`,
`@AnyKeyJdbcTypeCode`). The `@JdbcType` specifies a specific `JdbcType` implementation to use while `@JdbcTypeCode`
specifies a "code" that is then resolved against the `JdbcTypeRegistry`.
[TIP]
====
The "type code" relative to a `JdbcType` generally maps to the corresponding value in `java.sql.Types`.
registers entries in the `JdbcTypeRegistry` for all the standard `java.sql.Types` codes (aside from OTHER, which
is special). See <<basic-mapping-registries>> for more discussion.
====
Customizing the `JdbcTypeRegistry` can be accomplished through `@JdbcTypeRegistration` and
`TypeContributor`. See <<basic-mapping-registries>> for discussion of `JavaTypeRegistry`.
See <<basic-type-contributor>> for discussion of `TypeContributor`.
See the `@JdbcTypeCode` Javadoc for details.
See <<basic-mapping-composition-resolution>> for a discussion of the process used to resolve the
mapping composition.
[[basic-mapping-composition-mutability]]
===== MutabilityPlan
`MutabilityPlan` is the means by which Hibernate understands how to deal with the domain value in terms
of its internal mutability as well as related concerns such as making copies. While it seems like a minor
concern, it can have a major impact on performance. See <<basic-jpa-convert-mutability>> for one case where
this can manifest. See also <<basic-bitset>> for another discussion.
The `MutabilityPlan` for a mapping can be influenced by any of the following annotations:
* `@Mutability`
* `@Immutable`
* `@MapKeyMutability`
* `@CollectionIdMutability`
Hibernate checks the following places for `@Mutability` and `@Immutable`, in order of precedence:
. Local to the mapping
. On the associated `AttributeConverter` implementation class (if one)
. On the value's Java type
In most cases, the fallback defined by `JavaType#getMutabilityPlan` is the proper strategy.
Hibernate uses `MutabilityPlan` to:
1. Check whether a value is considered dirty
2. Make deep copies
3. Marshal values to and from the second-level cache
Generally speaking, immutable values perform better in all of these cases
1. To check for dirtiness, Hibernate just needs to check object identity (`==`) as opposed
to equality (`Object#equals`).
2. The same value instance can be used as the deep copy of itself.
3. The same value can be used from the second-level cache as well as the value we put into the
second-level cache.
If a particular Java type is considered mutable (a `Date` e.g.), `@Immuatble` or a immutable-specific
`MutabilityPlan` implementation can be specified to have Hibernate treat the value as immutable. This
also acts as a contract from the application that the internal state of these objects is not changed
by the application. Specifying that a mutable type is immutable and then changing the internal state
will lead to problems; so only do this if the application unequivocally does not change the internal
state.
See <<basic-mapping-composition-resolution>> for a discussion of the process used to resolve the
mapping composition.
[[basic-mapping-composition-conversion]]
===== BasicValueConverter
`BasicValueConverter` is roughly analogous to `AttributeConverter` in that it describes a conversion to
happen when reading or writing values of a basic-valued model part. In fact, internally Hibernate wraps
an applied `AttributeConverter` in a `BasicValueConverter`. It also applies implicit `BasicValueConverter`
converters in certain cases such as enum handling, etc.
Hibernate does not provide an explicit facility to influence these conversions beyond `AttributeConverter`.
See <<basic-jpa-convert>>.
See <<basic-mapping-composition-resolution>> for a discussion of the process used to resolve the
mapping composition.
[[basic-mapping-composition-resolution]]
===== Resolving the composition
Using this composition approach, Hibernate will need to resolve certain parts of this mapping. Often
this involves "filling in the blanks" as it will be configured for just parts of the mapping. This section
outlines how this resolution happens.
[NOTE]
====
This is a complicated process and is only covered at a high level for the most common cases here.
For the full specifics, consult the source code for `org.hibernate.mapping.BasicValue#buildResolution`
====
First, we look for a custom type. If found, this takes predence. See <<basic-mapping-custom>> for details
If an `AttributeConverter` is applied, we use it as the basis for the resolution
. If `@JavaType` is also used, that specific `JavaType` is used for the converter's "domain type". Otherwise,
the Java type defined by the converter as its "domain type" is resolved against the `JavaTypeRegistry`
. If `@JdbcType` or `@JdbcTypeCode` is used, the indicated `JdbcType` is used and the converted "relational Java
type" is determined by `JdbcType#getJdbcRecommendedJavaTypeMapping`. Otherwise, the Java type define by the
converter as its relational type is used and the `JdbcType` is determined by `JdbcType#getRecommendedJdbcType`
. The `MutabilityPlan` can be specified using `@Mutability` or `@Immutable` on the `AttributeConverter` implementation,
the basic value mapping or the Java type used as the domain-type. Otherwise, `JdbcType#getJdbcRecommendedJavaTypeMapping`
for the conversion's domain-type is used to determine the mutability-plan.
Next we try to resolve the `JavaType` to use for the mapping. We check for an explicit `@JavaType` and use the specified
`JavaType` if found. Next any "implicit" indication is checked; for example, the index for a List has the implicit Java type
of `Integer`. Next, we use reflection if possible. If we are unable to determine the `JavaType` to use through the preceeding
steps, we try to resolve an explicitly specified `JdbcType` to use and, if found, use its
`JdbcType#getJdbcRecommendedJavaTypeMapping` as the mapping's `JavaType`. If we are not able to determine the
`JavaType` by this point, an error is thrown.
The `JavaType` resolved earlier is then inspected for a number of special cases.
. For enum values, we check for an explicit `@Enumerated` and create an enumeration mapping. Note that this resolution
still uses any explicit `JdbcType` indicators
. For temporal values, we check for `@Temporal` and create an enumeration mapping. Note that this resolution
still uses any explicit `JdbcType` indicators; this includes `@JdbcType` and `@JdbcTypeCode`, as well as
`@TimeZoneStorage` and `@TimeZoneColumn` if appropriate.
The fallback at this point is to use the `JavaType` and `JdbcType` determined in earlier steps to create a
JDBC-mapping (which encapsulates the `JavaType` and `JdbcType`) and combines it with the resolved `MutabilityPlan`
When using the compositional approach, there are other ways to influence the resolution as covered
in <<basic-enums>>, <<basic-temporal>>, <<basic-lob>> and <<basic-nationalized>>
See <<basic-type-contributor>> for an alternative to `@JavaTypeRegistration` and `@JdbcTypeRegistration`.
@ -1599,9 +1754,21 @@ If the Java type is not known to Hibernate, you will encounter the following mes
> This can lead to significant performance problems when performing equality/dirty checking involving this Java type.
> Consider registering a custom JavaTypeDescriptor or at least implementing equals/hashCode.
A Java type is "known" if it has an entry in the `JavaTypeDescriptorRegistry`. While Hibernate does load many JDK types into
the `JavaTypeDescriptorRegistry`, an application can also expand the `JavaTypeDescriptorRegistry` by adding new `JavaType`
entries. This way, Hibernate will also know how to handle a specific Java Object type at the JDBC level.
A Java type is "known" if it has an entry in the `JavaTypeRegistry`. While Hibernate does load many JDK types into
the `JavaTypeRegistry`, an application can also expand the `JavaTypeRegistry` by adding new `JavaType`
entries as discussed in <<basic-mapping-composition>> and <<basic-type-contributor>>.
@ -1788,6 +1955,28 @@ By passing the associated Hibernate `Type`, you can use the `Caption` object whe
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[[basic-mapping-registries]]
==== Registries
We've covered `JavaTypeRegistry` and `JdbcTypeRegistry` a few times now, mainly in regards to mapping resolution
as discussed in <<basic-mapping-composition-resolution>>. But they each also serve additional important roles.
The `JavaTypeRegistry` is a registry of `JavaType` references keyed by Java type. In addition to mapping resolution,
this registry is used to handle `Class` references exposed in various APIs such as `Query` parameter types.
`JavaType` references can be registered through `@JavaTypeRegistration`.
The `JdbcTypeRegistry` is a registry of `JdbcType` references keyed by an integer code. As discussed in
<<basic-mapping-composition-jdbc>>, these type-codes typically match with the corresponding code from
`java.sql.Types`, but that is not a requirement - integers other than those defined by `java.sql.Types` can
be used. This might be useful for mapping JDBC User Data Types (UDTs) or other specialized database-specific
types (PostgreSQL's UUID type, e.g.). In addition to its use in mapping resolution, this registry is also used
as the primary source for resolving "discovered" values in a JDBC `ResultSet`. `JdbcType` references can be
registered through `@JdbcTypeRegistration`.
See <<basic-type-contributor>> for an alternative to `@JavaTypeRegistration` and `@JdbcTypeRegistration` for
registration.
[[basic-type-contributor]]
==== TypeContributor
@ -1801,6 +1990,14 @@ a Java service (see `java.util.ServiceLoader`).
`JdbcType` and `BasicType` references.
[[IMPORTANT]]
====
While `TypeContributor` still exposes the ability to register `BasicType` references, this is considered
deprecated. As of 6.0, these `BasicType` registrations are only used while interpreting `hbm.xml` mappings,
which are themselves considered deprecated. Use <<basic-mapping-custom>> or <<basic-mapping-composition>> instead.
====
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[[basic-bitset]]

View File

@ -16,7 +16,7 @@ import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.mapping.internal.BasicAttributeMapping;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
@ -42,7 +42,7 @@ public class BigDecimalMappingTests {
// first, verify the type selections...
final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor( EntityOfBigDecimals.class );
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
{

View File

@ -16,7 +16,7 @@ import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.mapping.internal.BasicAttributeMapping;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
@ -42,7 +42,7 @@ public class BigIntegerMappingTests {
// first, verify the type selections...
final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor( EntityOfBigIntegers.class );
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
{

View File

@ -12,11 +12,10 @@ import jakarta.persistence.Id;
import jakarta.persistence.Table;
import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.metamodel.mapping.AttributeMapping;
import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.mapping.internal.BasicAttributeMapping;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
@ -24,8 +23,6 @@ import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.hamcrest.Matchers;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
@ -44,7 +41,7 @@ public class ByteMappingTests {
// first, verify the type selections...
final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor( EntityOfBytes.class );
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
{

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.userguide.mapping.basic;
import java.sql.Types;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Lob;
@ -19,7 +18,7 @@ import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.mapping.internal.BasicAttributeMapping;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.testing.orm.junit.DialectFeatureChecks;
import org.hibernate.testing.orm.junit.DomainModel;
@ -29,7 +28,6 @@ import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
/**
@ -45,7 +43,7 @@ public class CharacterArrayNationalizedMappingTests {
public void verifyMappings(SessionFactoryScope scope) {
final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor( EntityWithCharArrays.class );
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
final Dialect dialect = scope.getSessionFactory().getJdbcServices().getDialect();

View File

@ -18,9 +18,7 @@ import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.type.SqlTypes;
import org.hibernate.type.descriptor.jdbc.AdjustableJdbcType;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.spi.TypeConfiguration;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
@ -42,7 +40,7 @@ public class DurationMappingTests {
public void verifyMappings(SessionFactoryScope scope) {
final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor( EntityWithDuration.class );
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
final BasicAttributeMapping duration = (BasicAttributeMapping) entityDescriptor.findAttributeMapping( "duration" );

View File

@ -6,8 +6,6 @@
*/
package org.hibernate.userguide.mapping.basic;
import java.sql.Types;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Lob;
@ -20,7 +18,7 @@ import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.mapping.internal.BasicAttributeMapping;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
@ -46,7 +44,7 @@ public class StringNationalizedMappingTests {
// first, verify the type selections...
final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor( EntityOfStrings.class );
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
final Dialect dialect = scope.getSessionFactory().getJdbcServices().getDialect();

View File

@ -34,7 +34,7 @@ import org.hibernate.sql.exec.spi.JdbcOperation;
import org.hibernate.community.dialect.sequence.SequenceInformationExtractorCUBRIDDatabaseImpl;
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import java.sql.Types;
@ -120,16 +120,16 @@ public class CUBRIDDialect extends Dialect {
int jdbcTypeCode,
int precision,
int scale,
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
JdbcTypeRegistry jdbcTypeRegistry) {
if ( jdbcTypeCode == Types.BIT ) {
return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
return jdbcTypeRegistry.getDescriptor( Types.BOOLEAN );
}
return super.resolveSqlTypeDescriptor(
columnTypeName,
jdbcTypeCode,
precision,
scale,
jdbcTypeDescriptorRegistry
jdbcTypeRegistry
);
}

View File

@ -38,7 +38,7 @@ import org.hibernate.sql.ast.tree.Statement;
import org.hibernate.sql.exec.spi.JdbcOperation;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import java.sql.CallableStatement;
import java.sql.ResultSet;
@ -100,16 +100,16 @@ public class CacheDialect extends Dialect {
int jdbcTypeCode,
int precision,
int scale,
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
JdbcTypeRegistry jdbcTypeRegistry) {
if ( jdbcTypeCode == Types.BIT ) {
return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
return jdbcTypeRegistry.getDescriptor( Types.BOOLEAN );
}
return super.resolveSqlTypeDescriptor(
columnTypeName,
jdbcTypeCode,
precision,
scale,
jdbcTypeDescriptorRegistry
jdbcTypeRegistry
);
}

View File

@ -58,7 +58,7 @@ import org.hibernate.type.BasicType;
import org.hibernate.type.BasicTypeRegistry;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
@ -181,16 +181,16 @@ public class FirebirdDialect extends Dialect {
int jdbcTypeCode,
int precision,
int scale,
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
JdbcTypeRegistry jdbcTypeRegistry) {
if ( jdbcTypeCode == Types.BIT ) {
return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
return jdbcTypeRegistry.getDescriptor( Types.BOOLEAN );
}
return super.resolveSqlTypeDescriptor(
columnTypeName,
jdbcTypeCode,
precision,
scale,
jdbcTypeDescriptorRegistry
jdbcTypeRegistry
);
}

View File

@ -54,7 +54,7 @@ import org.hibernate.type.BasicType;
import org.hibernate.type.BasicTypeRegistry;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import java.sql.Types;
import jakarta.persistence.TemporalType;
@ -183,16 +183,16 @@ public class IngresDialect extends Dialect {
int jdbcTypeCode,
int precision,
int scale,
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
JdbcTypeRegistry jdbcTypeRegistry) {
if ( jdbcTypeCode == Types.BIT ) {
return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
return jdbcTypeRegistry.getDescriptor( Types.BOOLEAN );
}
return super.resolveSqlTypeDescriptor(
columnTypeName,
jdbcTypeCode,
precision,
scale,
jdbcTypeDescriptorRegistry
jdbcTypeRegistry
);
}

View File

@ -32,7 +32,7 @@ import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
import org.hibernate.type.BasicType;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import java.sql.DatabaseMetaData;
import java.sql.Types;
@ -71,12 +71,12 @@ public class MaxDBDialect extends Dialect {
int jdbcTypeCode,
int precision,
int scale,
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
JdbcTypeRegistry jdbcTypeRegistry) {
switch ( jdbcTypeCode ) {
case Types.NUMERIC:
case Types.DECIMAL:
if ( precision == 19 && scale == 0 ) {
return jdbcTypeDescriptorRegistry.getDescriptor( Types.BIGINT );
return jdbcTypeRegistry.getDescriptor( Types.BIGINT );
}
}
return super.resolveSqlTypeDescriptor(
@ -84,7 +84,7 @@ public class MaxDBDialect extends Dialect {
jdbcTypeCode,
precision,
scale,
jdbcTypeDescriptorRegistry
jdbcTypeRegistry
);
}

View File

@ -31,7 +31,7 @@ import org.hibernate.sql.ast.spi.StandardSqlAstTranslatorFactory;
import org.hibernate.sql.ast.tree.Statement;
import org.hibernate.sql.exec.spi.JdbcOperation;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.jboss.logging.Logger;
@ -124,16 +124,16 @@ public class RDMSOS2200Dialect extends Dialect {
int jdbcTypeCode,
int precision,
int scale,
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
JdbcTypeRegistry jdbcTypeRegistry) {
if ( jdbcTypeCode == Types.BIT ) {
return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
return jdbcTypeRegistry.getDescriptor( Types.BOOLEAN );
}
return super.resolveSqlTypeDescriptor(
columnTypeName,
jdbcTypeCode,
precision,
scale,
jdbcTypeDescriptorRegistry
jdbcTypeRegistry
);
}

View File

@ -56,7 +56,7 @@ import org.hibernate.type.BasicTypeRegistry;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.jdbc.BlobJdbcType;
import org.hibernate.type.descriptor.jdbc.ClobJdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import static org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtractor.extractUsingTemplate;
import static org.hibernate.query.TemporalUnit.DAY;
@ -328,7 +328,7 @@ public class SQLiteDialect extends Dialect {
@Override
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
super.contributeTypes( typeContributions, serviceRegistry );
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
jdbcTypeRegistry.addDescriptor( Types.BLOB, BlobJdbcType.PRIMITIVE_ARRAY_BINDING );
jdbcTypeRegistry.addDescriptor( Types.CLOB, ClobJdbcType.STRING_BINDING );

View File

@ -48,7 +48,7 @@ import org.hibernate.type.BasicType;
import org.hibernate.type.BasicTypeRegistry;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import java.sql.CallableStatement;
import java.sql.ResultSet;
@ -132,14 +132,14 @@ public class TeradataDialect extends Dialect {
String columnTypeName, int jdbcTypeCode,
int precision,
int scale,
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
JdbcTypeRegistry jdbcTypeRegistry) {
switch ( jdbcTypeCode ) {
case Types.BIT:
return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
return jdbcTypeRegistry.getDescriptor( Types.BOOLEAN );
case Types.NUMERIC:
case Types.DECIMAL:
if ( precision == 19 && scale == 0 ) {
return jdbcTypeDescriptorRegistry.getDescriptor( Types.BIGINT );
return jdbcTypeRegistry.getDescriptor( Types.BIGINT );
}
}
return super.resolveSqlTypeDescriptor(
@ -147,7 +147,7 @@ public class TeradataDialect extends Dialect {
jdbcTypeCode,
precision,
scale,
jdbcTypeDescriptorRegistry
jdbcTypeRegistry
);
}

View File

@ -39,7 +39,7 @@ import org.hibernate.community.dialect.sequence.SequenceInformationExtractorTime
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import java.sql.Types;
import jakarta.persistence.TemporalType;
@ -112,16 +112,16 @@ public class TimesTenDialect extends Dialect {
int jdbcTypeCode,
int precision,
int scale,
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
JdbcTypeRegistry jdbcTypeRegistry) {
if ( jdbcTypeCode == Types.BIT ) {
return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
return jdbcTypeRegistry.getDescriptor( Types.BOOLEAN );
}
return super.resolveSqlTypeDescriptor(
columnTypeName,
jdbcTypeCode,
precision,
scale,
jdbcTypeDescriptorRegistry
jdbcTypeRegistry
);
}

View File

@ -9,6 +9,7 @@ package org.hibernate.annotations;
import java.lang.annotation.Retention;
import org.hibernate.type.descriptor.java.BasicJavaType;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.FIELD;
@ -19,7 +20,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* Specifies the Java Class to use for the foreign-key handling related to an ANY mapping.
*
* The specified class is resolved to a {@link BasicJavaType}
* via the {@link org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry}
* via the {@link JavaTypeRegistry}
*
* @see Any
* @see AnyKeyJavaType

View File

@ -10,7 +10,7 @@ import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.FIELD;
@ -48,7 +48,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* of basic value mapping.
*
* @see JdbcType
* @see JdbcTypeDescriptorRegistry
* @see JdbcTypeRegistry
* @see MapKeyJdbcTypeCode
* @see CollectionIdJdbcTypeCode
* @see ListIndexJdbcTypeCode

View File

@ -11,14 +11,14 @@ import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import static java.lang.annotation.ElementType.PACKAGE;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Describes a SqlTypeDescriptor to be added to the {@link JdbcTypeDescriptorRegistry}
* Describes a SqlTypeDescriptor to be added to the {@link JdbcTypeRegistry}
*
* Registrations applied to a package are processed before Hibernate begins to process
* any attributes, etc.

View File

@ -9,8 +9,8 @@ package org.hibernate.boot.model;
import org.hibernate.type.BasicType;
import org.hibernate.type.StandardBasicTypeTemplate;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.spi.TypeConfiguration;
import org.hibernate.usertype.UserType;
@ -25,16 +25,20 @@ public interface TypeContributions {
/**
* Add the JavaTypeDescriptor to the {@link TypeConfiguration}'s
* {@link JavaTypeDescriptorRegistry}
* {@link JavaTypeRegistry}
*/
void contributeJavaTypeDescriptor(JavaType descriptor);
/**
* Add the JdbcType to the {@link TypeConfiguration}'s
* {@link JdbcTypeDescriptorRegistry}
* {@link JdbcTypeRegistry}
*/
void contributeJdbcTypeDescriptor(JdbcType descriptor);
/**
* @deprecated (6.0) See user-guide section `2.2.46. TypeContributor` for details - `basic_types.adoc`
*/
@Deprecated
void contributeType(BasicType type);
/**

View File

@ -7,7 +7,7 @@
package org.hibernate.boot.model.convert.spi;
import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
/**
@ -21,7 +21,7 @@ public interface JpaAttributeConverterCreationContext {
ManagedBeanRegistry getManagedBeanRegistry();
TypeConfiguration getTypeConfiguration();
default JavaTypeDescriptorRegistry getJavaTypeDescriptorRegistry() {
default JavaTypeRegistry getJavaTypeDescriptorRegistry() {
return getTypeConfiguration().getJavaTypeDescriptorRegistry();
}
}

View File

@ -391,7 +391,7 @@ public class InferredBasicValueResolver {
final TemporalType requestedTemporalPrecision = stdIndicators.getTemporalPrecision();
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Case #1 - explicit JavaTypeDescriptor
// Case #1 - explicit JavaType
if ( explicitJavaType != null ) {
if ( !TemporalJavaTypeDescriptor.class.isInstance( explicitJavaType ) ) {

View File

@ -47,9 +47,9 @@ import org.hibernate.type.BasicTypeRegistry;
import org.hibernate.type.CustomType;
import org.hibernate.type.SqlTypes;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.internal.NamedBasicTypeImpl;
import org.hibernate.type.spi.TypeConfiguration;
import org.hibernate.usertype.UserType;
@ -364,21 +364,11 @@ public class MetadataBuildingProcess {
@Override
public void contributeType(BasicType type) {
getBasicTypeRegistry().register( type );
final JavaType<?> jtd;
if ( type instanceof CustomType ) {
final CustomType<Object> customType = (CustomType<Object>) type;
jtd = customType.getJavaTypeDescriptor();
}
else {
jtd = type.getJavaTypeDescriptor();
}
conditionallyRegisterJtd( jtd );
conditionallyRegisterJtd( type.getJavaTypeDescriptor() );
}
private void conditionallyRegisterJtd(JavaType jtd) {
final JavaTypeDescriptorRegistry jtdRegistry = getTypeConfiguration().getJavaTypeDescriptorRegistry();
final JavaTypeRegistry jtdRegistry = getTypeConfiguration().getJavaTypeDescriptorRegistry();
jtdRegistry.resolveDescriptor( jtd.getJavaTypeClass(), () -> jtd );
}
@ -424,7 +414,7 @@ public class MetadataBuildingProcess {
}
// add fallback type descriptors
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = bootstrapContext.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = bootstrapContext.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
addFallbackIfNecessary( jdbcTypeRegistry, SqlTypes.UUID, SqlTypes.BINARY );
addFallbackIfNecessary( jdbcTypeRegistry, SqlTypes.JSON, SqlTypes.VARBINARY );
@ -439,7 +429,7 @@ public class MetadataBuildingProcess {
// For NORMALIZE, we replace the standard types that use TIMESTAMP_WITH_TIMEZONE to use TIMESTAMP
if ( options.getDefaultTimeZoneStorage() == TimeZoneStorageStrategy.NORMALIZE ) {
final JavaTypeDescriptorRegistry javaTypeRegistry = bootstrapContext.getTypeConfiguration()
final JavaTypeRegistry javaTypeRegistry = bootstrapContext.getTypeConfiguration()
.getJavaTypeDescriptorRegistry();
final JdbcType timestampDescriptor = jdbcTypeRegistry.getDescriptor( Types.TIMESTAMP );
final BasicTypeRegistry basicTypeRegistry = bootstrapContext.getTypeConfiguration().getBasicTypeRegistry();
@ -469,7 +459,7 @@ public class MetadataBuildingProcess {
}
private static void addFallbackIfNecessary(
JdbcTypeDescriptorRegistry jdbcTypeRegistry,
JdbcTypeRegistry jdbcTypeRegistry,
int typeCode,
int fallbackTypeCode) {
if ( !jdbcTypeRegistry.hasRegisteredDescriptor( typeCode ) ) {

View File

@ -62,7 +62,7 @@ import org.hibernate.type.descriptor.java.DataHelper;
import org.hibernate.type.descriptor.java.DoubleJavaTypeDescriptor;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.jdbc.*;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.internal.BasicTypeImpl;
import java.io.*;
@ -1433,7 +1433,7 @@ public abstract class AbstractHANADialect extends Dialect {
this.treatDoubleTypedFieldsAsDecimal = configurationService.getSetting( TREAT_DOUBLE_TYPED_FIELDS_AS_DECIMAL_PARAMETER_NAME, StandardConverters.BOOLEAN,
TREAT_DOUBLE_TYPED_FIELDS_AS_DECIMAL_DEFAULT_VALUE ).booleanValue();
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
if ( this.treatDoubleTypedFieldsAsDecimal ) {
registerHibernateType( Types.FLOAT, StandardBasicTypes.BIG_DECIMAL.getName() );

View File

@ -28,7 +28,7 @@ import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy;
import org.hibernate.sql.ast.spi.SqlAppender;
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaTypeDescriptor;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import java.sql.CallableStatement;
import java.sql.ResultSet;
@ -76,16 +76,16 @@ public abstract class AbstractTransactSQLDialect extends Dialect {
int jdbcTypeCode,
int precision,
int scale,
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
JdbcTypeRegistry jdbcTypeRegistry) {
if ( jdbcTypeCode == Types.BIT ) {
return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
return jdbcTypeRegistry.getDescriptor( Types.BOOLEAN );
}
return super.resolveSqlTypeDescriptor(
columnTypeName,
jdbcTypeCode,
precision,
scale,
jdbcTypeDescriptorRegistry
jdbcTypeRegistry
);
}

View File

@ -39,7 +39,7 @@ import org.hibernate.type.SqlTypes;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.UUIDJdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
@ -148,7 +148,7 @@ public class CockroachDialect extends Dialect {
int jdbcTypeCode,
int precision,
int scale,
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
JdbcTypeRegistry jdbcTypeRegistry) {
if ( jdbcTypeCode == SqlTypes.OTHER ) {
switch ( columnTypeName ) {
case "uuid":
@ -163,14 +163,14 @@ public class CockroachDialect extends Dialect {
break;
}
}
return jdbcTypeDescriptorRegistry.getDescriptor( jdbcTypeCode );
return jdbcTypeRegistry.getDescriptor( jdbcTypeCode );
}
@Override
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
super.contributeTypes( typeContributions, serviceRegistry );
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
if ( driverKind == PostgreSQLDriverKind.PG_JDBC ) {
jdbcTypeRegistry.addDescriptorIfAbsent( UUIDJdbcType.INSTANCE );

View File

@ -47,7 +47,7 @@ import org.hibernate.type.JavaObjectType;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaTypeDescriptor;
import org.hibernate.type.descriptor.jdbc.*;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import java.sql.CallableStatement;
import java.sql.ResultSet;
@ -507,7 +507,7 @@ public class DB2Dialect extends Dialect {
super.contributeTypes( typeContributions, serviceRegistry );
final int version = getVersion();
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
if ( version < 1100 ) {

View File

@ -60,7 +60,7 @@ import org.hibernate.type.descriptor.jdbc.DecimalJdbcType;
import org.hibernate.type.descriptor.jdbc.ObjectNullResolvingJdbcType;
import org.hibernate.type.descriptor.jdbc.SmallIntJdbcType;
import org.hibernate.type.descriptor.jdbc.TimestampJdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import java.sql.Types;
@ -498,7 +498,7 @@ public class DerbyDialect extends Dialect {
@Override
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
super.contributeTypes( typeContributions, serviceRegistry );
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
if ( getVersion() < 1070 ) {
jdbcTypeRegistry.addDescriptor( Types.BOOLEAN, SmallIntJdbcType.INSTANCE );

View File

@ -89,7 +89,7 @@ import org.hibernate.type.descriptor.jdbc.LongNVarcharJdbcType;
import org.hibernate.type.descriptor.jdbc.NCharJdbcType;
import org.hibernate.type.descriptor.jdbc.NClobJdbcType;
import org.hibernate.type.descriptor.jdbc.NVarcharJdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import jakarta.persistence.TemporalType;
import java.io.InputStream;
@ -261,8 +261,8 @@ public abstract class Dialect implements ConversionContext {
int jdbcTypeCode,
int precision,
int scale,
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
return jdbcTypeDescriptorRegistry.getDescriptor( jdbcTypeCode );
JdbcTypeRegistry jdbcTypeRegistry) {
return jdbcTypeRegistry.getDescriptor( jdbcTypeCode );
}
public int resolveSqlTypeLength(

View File

@ -57,7 +57,7 @@ import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorNo
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
import org.hibernate.type.SqlTypes;
import org.hibernate.type.descriptor.jdbc.UUIDJdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.jboss.logging.Logger;
@ -153,7 +153,7 @@ public class H2Dialect extends Dialect {
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
super.contributeTypes( typeContributions, serviceRegistry );
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
jdbcTypeRegistry.addDescriptorIfAbsent( UUIDJdbcType.INSTANCE );
jdbcTypeRegistry.addDescriptorIfAbsent( DurationIntervalSecondJdbcType.INSTANCE );

View File

@ -63,7 +63,7 @@ import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.JsonJdbcType;
import org.hibernate.type.descriptor.jdbc.NullJdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import java.sql.CallableStatement;
import java.sql.DatabaseMetaData;
@ -309,16 +309,16 @@ public class MySQLDialect extends Dialect {
int jdbcTypeCode,
int precision,
int scale,
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
JdbcTypeRegistry jdbcTypeRegistry) {
if ( jdbcTypeCode == Types.BIT ) {
return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
return jdbcTypeRegistry.getDescriptor( Types.BOOLEAN );
}
return super.resolveSqlTypeDescriptor(
columnTypeName,
jdbcTypeCode,
precision,
scale,
jdbcTypeDescriptorRegistry
jdbcTypeRegistry
);
}
@ -406,7 +406,7 @@ public class MySQLDialect extends Dialect {
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
super.contributeTypes( typeContributions, serviceRegistry );
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
if ( getMySQLVersion() >= 570) {

View File

@ -66,7 +66,7 @@ import org.hibernate.type.descriptor.jdbc.BlobJdbcType;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.NullJdbcType;
import org.hibernate.type.descriptor.jdbc.ObjectNullAsNullTypeJdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import java.sql.CallableStatement;
import java.sql.ResultSet;
@ -610,30 +610,30 @@ public class OracleDialect extends Dialect {
int jdbcTypeCode,
int precision,
int scale,
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
JdbcTypeRegistry jdbcTypeRegistry) {
// This is the reverse of what registerNumericTypeMappings registers
switch ( jdbcTypeCode ) {
case Types.NUMERIC:
// For some reason, the Oracle JDBC driver reports floats as numerics with scale -127
if ( scale == -127 ) {
if ( precision <= getFloatPrecision() ) {
return jdbcTypeDescriptorRegistry.getDescriptor( Types.FLOAT );
return jdbcTypeRegistry.getDescriptor( Types.FLOAT );
}
return jdbcTypeDescriptorRegistry.getDescriptor( Types.DOUBLE );
return jdbcTypeRegistry.getDescriptor( Types.DOUBLE );
}
case Types.DECIMAL:
if ( scale == 0 ) {
switch ( precision ) {
case 1:
return jdbcTypeDescriptorRegistry.getDescriptor( Types.BOOLEAN );
return jdbcTypeRegistry.getDescriptor( Types.BOOLEAN );
case 3:
return jdbcTypeDescriptorRegistry.getDescriptor( Types.TINYINT );
return jdbcTypeRegistry.getDescriptor( Types.TINYINT );
case 5:
return jdbcTypeDescriptorRegistry.getDescriptor( Types.SMALLINT );
return jdbcTypeRegistry.getDescriptor( Types.SMALLINT );
case 10:
return jdbcTypeDescriptorRegistry.getDescriptor( Types.INTEGER );
return jdbcTypeRegistry.getDescriptor( Types.INTEGER );
case 19:
return jdbcTypeDescriptorRegistry.getDescriptor( Types.BIGINT );
return jdbcTypeRegistry.getDescriptor( Types.BIGINT );
}
}
}
@ -642,7 +642,7 @@ public class OracleDialect extends Dialect {
jdbcTypeCode,
precision,
scale,
jdbcTypeDescriptorRegistry
jdbcTypeRegistry
);
}

View File

@ -75,7 +75,7 @@ import org.hibernate.type.descriptor.jdbc.ClobJdbcType;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.ObjectNullAsBinaryTypeJdbcType;
import org.hibernate.type.descriptor.jdbc.UUIDJdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import static org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtractor.extractUsingTemplate;
import static org.hibernate.query.TemporalUnit.*;
@ -179,7 +179,7 @@ public class PostgreSQLDialect extends Dialect {
int jdbcTypeCode,
int precision,
int scale,
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
JdbcTypeRegistry jdbcTypeRegistry) {
if ( jdbcTypeCode == SqlTypes.OTHER ) {
switch ( columnTypeName ) {
case "uuid":
@ -194,7 +194,7 @@ public class PostgreSQLDialect extends Dialect {
break;
}
}
return jdbcTypeDescriptorRegistry.getDescriptor( jdbcTypeCode );
return jdbcTypeRegistry.getDescriptor( jdbcTypeCode );
}
@Override
@ -989,7 +989,7 @@ public class PostgreSQLDialect extends Dialect {
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
super.contributeTypes(typeContributions, serviceRegistry);
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
// 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>.

View File

@ -40,7 +40,7 @@ import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.TimestampJdbcType;
import org.hibernate.type.descriptor.jdbc.TinyIntJdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import static org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtractor.extractUsingTemplate;
@ -190,7 +190,7 @@ public class SybaseASEDialect extends SybaseDialect {
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
super.contributeTypes( typeContributions, serviceRegistry );
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
jdbcTypeRegistry.addDescriptor( Types.BOOLEAN, TinyIntJdbcType.INSTANCE );
// At least the jTDS driver does not support this type code

View File

@ -45,7 +45,7 @@ import org.hibernate.type.descriptor.jdbc.ClobJdbcType;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.ObjectNullAsNullTypeJdbcType;
import org.hibernate.type.descriptor.jdbc.SmallIntJdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
@ -92,16 +92,16 @@ public class SybaseDialect extends AbstractTransactSQLDialect {
int jdbcTypeCode,
int precision,
int scale,
JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry) {
JdbcTypeRegistry jdbcTypeRegistry) {
switch ( jdbcTypeCode ) {
case Types.NUMERIC:
case Types.DECIMAL:
if ( precision == 19 && scale == 0 ) {
return jdbcTypeDescriptorRegistry.getDescriptor( Types.BIGINT );
return jdbcTypeRegistry.getDescriptor( Types.BIGINT );
}
case Types.TINYINT:
if ( jtdsDriver ) {
return jdbcTypeDescriptorRegistry.getDescriptor( Types.SMALLINT );
return jdbcTypeRegistry.getDescriptor( Types.SMALLINT );
}
}
return super.resolveSqlTypeDescriptor(
@ -109,7 +109,7 @@ public class SybaseDialect extends AbstractTransactSQLDialect {
jdbcTypeCode,
precision,
scale,
jdbcTypeDescriptorRegistry
jdbcTypeRegistry
);
}
@ -165,7 +165,7 @@ public class SybaseDialect extends AbstractTransactSQLDialect {
@Override
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
super.contributeTypes(typeContributions, serviceRegistry);
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = typeContributions.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
if ( jtdsDriver ) {
jdbcTypeRegistry.addDescriptor( Types.TINYINT, SmallIntJdbcType.INSTANCE );

View File

@ -387,7 +387,7 @@ public class BasicValue extends SimpleValue implements JdbcTypeDescriptorIndicat
JavaType jtd = null;
// determine JTD if we can
// determine JavaType if we can
if ( explicitJavaTypeAccess != null ) {
final BasicJavaType explicitJtd = explicitJavaTypeAccess.apply( typeConfiguration );

View File

@ -51,7 +51,7 @@ import org.hibernate.type.AnyType;
import org.hibernate.type.EmbeddedComponentType;
import org.hibernate.type.EntityType;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
/**
* A factory for building {@link Attribute} instances. Exposes 3 main services for building<ol>
@ -257,7 +257,7 @@ public class AttributeFactory {
return cached;
}
final JavaTypeDescriptorRegistry registry = context.getTypeConfiguration()
final JavaTypeRegistry registry = context.getTypeConfiguration()
.getJavaTypeDescriptorRegistry();
final JavaType<Y> javaTypeDescriptor = registry.resolveManagedTypeDescriptor( embeddableClass );

View File

@ -53,7 +53,7 @@ import org.hibernate.proxy.pojo.ProxyFactoryHelper;
import org.hibernate.tuple.entity.EntityMetamodel;
import org.hibernate.type.CompositeType;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
/**
* @author Steve Ebersole
@ -83,7 +83,7 @@ public class EntityRepresentationStrategyPojoStandard implements EntityRepresent
EntityPersister runtimeDescriptor,
RuntimeModelCreationContext creationContext) {
final SessionFactoryImplementor sessionFactory = creationContext.getSessionFactory();
final JavaTypeDescriptorRegistry jtdRegistry = creationContext.getTypeConfiguration()
final JavaTypeRegistry jtdRegistry = creationContext.getTypeConfiguration()
.getJavaTypeDescriptorRegistry();
final Class<?> mappedJavaType = bootDescriptor.getMappedClass();

View File

@ -51,7 +51,7 @@ import org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
/**
@ -124,7 +124,7 @@ public class MetadataContext {
return typeConfiguration;
}
public JavaTypeDescriptorRegistry getJavaTypeDescriptorRegistry(){
public JavaTypeRegistry getJavaTypeDescriptorRegistry(){
return typeConfiguration.getJavaTypeDescriptorRegistry();
}
@ -423,7 +423,7 @@ public class MetadataContext {
}
private EmbeddableTypeImpl<?> applyIdClassMetadata(Component identifier, Component idClass) {
final JavaTypeDescriptorRegistry registry = getTypeConfiguration()
final JavaTypeRegistry registry = getTypeConfiguration()
.getJavaTypeDescriptorRegistry();
final Class<?> componentClass = identifier.getComponentClass();
final JavaType<?> javaTypeDescriptor = registry.resolveManagedTypeDescriptor( componentClass );
@ -660,7 +660,7 @@ public class MetadataContext {
return (BasicDomainType) basicDomainTypeMap.computeIfAbsent(
javaType,
jt -> {
final JavaTypeDescriptorRegistry registry =
final JavaTypeRegistry registry =
getTypeConfiguration()
.getJavaTypeDescriptorRegistry();
return new BasicTypeImpl<>( registry.resolveDescriptor( javaType ) );

View File

@ -36,7 +36,7 @@ import org.hibernate.sql.results.graph.basic.BasicFetch;
import org.hibernate.sql.results.graph.basic.BasicResult;
import org.hibernate.type.BasicType;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
import static org.hibernate.metamodel.RepresentationMode.MAP;
@ -305,7 +305,7 @@ public abstract class AbstractDiscriminatorMapping implements EntityDiscriminato
BasicType underlyingDiscriminatorType,
final SessionFactoryImplementor sessionFactory) {
final TypeConfiguration typeConfiguration = sessionFactory.getDomainModel().getTypeConfiguration();
final JavaTypeDescriptorRegistry jtdRegistry = typeConfiguration.getJavaTypeDescriptorRegistry();
final JavaTypeRegistry jtdRegistry = typeConfiguration.getJavaTypeDescriptorRegistry();
final JavaType<Object> domainJtd;
final Function<String,Object> entityNameHandler;

View File

@ -97,7 +97,7 @@ import org.hibernate.type.Type;
import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.MutabilityPlan;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
/**
@ -628,7 +628,7 @@ public class MappingModelCreationHelper {
final String sqlAliasStem = SqlAliasStemHelper.INSTANCE.generateStemFromAttributeName( bootProperty.getName() );
final CollectionMappingType<?> collectionMappingType;
final JavaTypeDescriptorRegistry jtdRegistry = creationContext.getJavaTypeDescriptorRegistry();
final JavaTypeRegistry jtdRegistry = creationContext.getJavaTypeDescriptorRegistry();
final CollectionPart elementDescriptor = interpretElement(
bootValueMapping,
@ -1495,7 +1495,7 @@ public class MappingModelCreationHelper {
final SessionFactoryImplementor sessionFactory = creationProcess.getCreationContext().getSessionFactory();
final TypeConfiguration typeConfiguration = sessionFactory.getTypeConfiguration();
final JavaTypeDescriptorRegistry jtdRegistry = typeConfiguration.getJavaTypeDescriptorRegistry();
final JavaTypeRegistry jtdRegistry = typeConfiguration.getJavaTypeDescriptorRegistry();
final JavaType<Object> baseJtd = jtdRegistry.getDescriptor(Object.class);
return new DiscriminatedCollectionPart(

View File

@ -15,7 +15,7 @@ import org.hibernate.metamodel.model.convert.spi.BasicValueConverter;
import org.hibernate.resource.beans.spi.ManagedBean;
import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
/**
@ -35,7 +35,7 @@ public class Converters {
final ManagedBean<? extends AttributeConverter<O, R>> converterBean = beanRegistry.getBean( converterClass );
final TypeConfiguration typeConfiguration = sfi.getTypeConfiguration();
final JavaTypeDescriptorRegistry jtdRegistry = typeConfiguration.getJavaTypeDescriptorRegistry();
final JavaTypeRegistry jtdRegistry = typeConfiguration.getJavaTypeDescriptorRegistry();
final JavaType<? extends AttributeConverter<O, R>> converterJtd = jtdRegistry.getDescriptor( converterClass );
return new JpaAttributeConverterImpl<>( converterBean, converterJtd, domainJtd, relationalJtd );

View File

@ -14,7 +14,7 @@ import org.hibernate.resource.beans.spi.ManagedBean;
import org.hibernate.type.descriptor.converter.AttributeConverterMutabilityPlanImpl;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.MutabilityPlan;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
import org.hibernate.type.descriptor.java.spi.RegistryHelper;
/**
@ -48,7 +48,7 @@ public class JpaAttributeConverterImpl<O,R> implements JpaAttributeConverter<O,R
this.attributeConverterBean = attributeConverterBean;
this.converterJtd = converterJtd;
final JavaTypeDescriptorRegistry jtdRegistry = context.getJavaTypeDescriptorRegistry();
final JavaTypeRegistry jtdRegistry = context.getJavaTypeDescriptorRegistry();
jdbcJtd = jtdRegistry.getDescriptor( jdbcJavaType );
//noinspection unchecked

View File

@ -12,7 +12,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.persister.spi.PersisterCreationContext;
import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
/**
@ -35,7 +35,7 @@ public interface RuntimeModelCreationContext extends PersisterCreationContext {
return getSessionFactory().getServiceRegistry().getService( ManagedBeanRegistry.class );
}
default JavaTypeDescriptorRegistry getJavaTypeDescriptorRegistry() {
default JavaTypeRegistry getJavaTypeDescriptorRegistry() {
return getTypeConfiguration().getJavaTypeDescriptorRegistry();
}

View File

@ -11,7 +11,7 @@ import org.hibernate.boot.spi.MetadataImplementor;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
/**
@ -38,7 +38,7 @@ public interface PersisterCreationContext {
return getSessionFactory().getServiceRegistry().getService( ManagedBeanRegistry.class );
}
default JavaTypeDescriptorRegistry getJavaTypeDescriptorRegistry() {
default JavaTypeRegistry getJavaTypeDescriptorRegistry() {
return getTypeConfiguration().getJavaTypeDescriptorRegistry();
}
}

View File

@ -16,7 +16,7 @@ import org.hibernate.query.named.NamedObjectRepository;
import org.hibernate.query.named.NamedResultSetMappingMemento;
import org.hibernate.query.results.ResultSetMapping;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
import org.jboss.logging.Logger;
@ -74,7 +74,7 @@ public class Util {
Consumer<String> querySpaceConsumer,
ResultSetMappingResolutionContext context) {
final MappingMetamodel domainModel = context.getSessionFactory().getDomainModel();
final JavaTypeDescriptorRegistry javaTypeDescriptorRegistry = domainModel.getTypeConfiguration().getJavaTypeDescriptorRegistry();
final JavaTypeRegistry javaTypeRegistry = domainModel.getTypeConfiguration().getJavaTypeDescriptorRegistry();
for ( Class<?> resultSetMappingClass : resultSetMappingClasses ) {
final EntityPersister entityDescriptor = domainModel.findEntityDescriptor( resultSetMappingClass );
@ -85,7 +85,7 @@ public class Util {
}
}
else {
final JavaType<?> basicType = javaTypeDescriptorRegistry.getDescriptor(
final JavaType<?> basicType = javaTypeRegistry.getDescriptor(
resultSetMappingClass );
if ( basicType != null ) {
resultSetMapping.addResultBuilder( new ScalarDomainResultBuilder<>( basicType ) );

View File

@ -26,7 +26,7 @@ import org.hibernate.query.sqm.tree.expression.SqmLiteralEntityType;
import org.hibernate.query.sqm.tree.from.SqmFrom;
import org.hibernate.type.descriptor.java.EnumJavaTypeDescriptor;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
/**
* @asciidoc
@ -216,14 +216,14 @@ public class BasicDotIdentifierConsumer implements DotIdentifierConsumer {
.getService( ClassLoaderService.class )
.classForName( prefix );
if ( namedClass != null ) {
final JavaTypeDescriptorRegistry javaTypeDescriptorRegistry = creationContext.getJpaMetamodel()
final JavaTypeRegistry javaTypeRegistry = creationContext.getJpaMetamodel()
.getTypeConfiguration()
.getJavaTypeDescriptorRegistry();
if ( namedClass.isEnum() ) {
return new SqmEnumLiteral(
Enum.valueOf( (Class) namedClass, terminal ),
(EnumJavaTypeDescriptor) javaTypeDescriptorRegistry.resolveDescriptor( namedClass ),
(EnumJavaTypeDescriptor) javaTypeRegistry.resolveDescriptor( namedClass ),
terminal,
creationContext.getNodeBuilder()
);
@ -232,7 +232,7 @@ public class BasicDotIdentifierConsumer implements DotIdentifierConsumer {
try {
final Field referencedField = namedClass.getDeclaredField( terminal );
if ( referencedField != null ) {
final JavaType<?> fieldJtd = javaTypeDescriptorRegistry
final JavaType<?> fieldJtd = javaTypeRegistry
.getDescriptor( referencedField.getType() );
//noinspection unchecked
return new SqmFieldLiteral( referencedField, fieldJtd, creationContext.getNodeBuilder() );

View File

@ -18,7 +18,7 @@ import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
import org.hibernate.type.BasicType;
import org.hibernate.type.CustomType;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
import org.hibernate.usertype.UserType;
@ -81,7 +81,7 @@ public class ResultMementoBasicStandard implements ResultMementoBasic {
this.explicitJavaTypeDescriptor = registeredBasicType.getJavaTypeDescriptor();
}
else {
final JavaTypeDescriptorRegistry jtdRegistry = typeConfiguration.getJavaTypeDescriptorRegistry();
final JavaTypeRegistry jtdRegistry = typeConfiguration.getJavaTypeDescriptorRegistry();
final JavaType<Object> registeredJtd = jtdRegistry.getDescriptor( definition.type() );
final ManagedBeanRegistry beanRegistry = sessionFactory.getServiceRegistry().getService( ManagedBeanRegistry.class );
if ( BasicType.class.isAssignableFrom( registeredJtd.getJavaTypeClass() ) ) {

View File

@ -25,7 +25,7 @@ import org.hibernate.sql.results.graph.basic.BasicResult;
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
import org.hibernate.type.BasicType;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
/**
@ -48,7 +48,7 @@ public class DynamicResultBuilderBasicConverted<O,R> implements DynamicResultBui
AttributeConverter<O, R> converter,
SessionFactoryImplementor sessionFactory) {
final TypeConfiguration typeConfiguration = sessionFactory.getTypeConfiguration();
final JavaTypeDescriptorRegistry jtdRegistry = typeConfiguration.getJavaTypeDescriptorRegistry();
final JavaTypeRegistry jtdRegistry = typeConfiguration.getJavaTypeDescriptorRegistry();
this.columnAlias = columnAlias;
this.domainJtd = jtdRegistry.getDescriptor( domainJavaType );
@ -74,7 +74,7 @@ public class DynamicResultBuilderBasicConverted<O,R> implements DynamicResultBui
SessionFactoryImplementor sessionFactory) {
final ManagedBeanRegistry beans = sessionFactory.getServiceRegistry().getService( ManagedBeanRegistry.class );
final TypeConfiguration typeConfiguration = sessionFactory.getTypeConfiguration();
final JavaTypeDescriptorRegistry jtdRegistry = typeConfiguration.getJavaTypeDescriptorRegistry();
final JavaTypeRegistry jtdRegistry = typeConfiguration.getJavaTypeDescriptorRegistry();
this.columnAlias = columnAlias;
this.domainJtd = jtdRegistry.getDescriptor( domainJavaType );

View File

@ -19,7 +19,6 @@ import jakarta.persistence.ParameterMode;
import org.hibernate.JDBCException;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.engine.spi.EntityKey;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.internal.CoreLogging;
@ -47,7 +46,7 @@ import org.hibernate.sql.results.jdbc.spi.JdbcValues;
import org.hibernate.sql.results.jdbc.spi.JdbcValuesSourceProcessingOptions;
import org.hibernate.sql.results.spi.RowReader;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
import org.jboss.logging.Logger;
@ -160,14 +159,14 @@ public class OutputsImpl implements Outputs {
final ProcedureCallImpl procedureCall = (ProcedureCallImpl) context;
final ResultSetMapping resultSetMapping = procedureCall.getResultSetMapping();
final JavaTypeDescriptorRegistry javaTypeDescriptorRegistry = context.getSession()
final JavaTypeRegistry javaTypeRegistry = context.getSession()
.getTypeConfiguration()
.getJavaTypeDescriptorRegistry();
procedureCall.getParameterBindings().visitBindings(
(parameterImplementor, queryParameterBinding) -> {
ProcedureParameter parameter = (ProcedureParameter) parameterImplementor;
if ( parameter.getMode() == ParameterMode.INOUT ) {
final JavaType<?> basicType = javaTypeDescriptorRegistry.getDescriptor(
final JavaType<?> basicType = javaTypeRegistry.getDescriptor(
parameterImplementor.getParameterType() );
if ( basicType != null ) {
resultSetMapping.addResultBuilder( new ScalarDomainResultBuilder<>( basicType ) );

View File

@ -24,7 +24,7 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
/**
* Descriptor for {@link Clob} handling.
@ -44,7 +44,7 @@ public class ClobJavaTypeDescriptor extends AbstractClassJavaTypeDescriptor<Clob
@Override
public JdbcType getRecommendedJdbcType(JdbcTypeDescriptorIndicators indicators) {
if ( indicators.isNationalized() ) {
final JdbcTypeDescriptorRegistry stdRegistry = indicators.getTypeConfiguration().getJdbcTypeDescriptorRegistry();
final JdbcTypeRegistry stdRegistry = indicators.getTypeConfiguration().getJdbcTypeDescriptorRegistry();
return stdRegistry.getDescriptor( Types.NCLOB );
}

View File

@ -25,7 +25,7 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
/**
@ -53,7 +53,7 @@ public class OffsetDateTimeJavaTypeDescriptor extends AbstractTemporalJavaTypeDe
@Override
public JdbcType getRecommendedJdbcType(JdbcTypeDescriptorIndicators stdIndicators) {
final TemporalType temporalPrecision = stdIndicators.getTemporalPrecision();
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = stdIndicators.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = stdIndicators.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
if ( temporalPrecision == null || temporalPrecision == TemporalType.TIMESTAMP ) {
return stdIndicators.getDefaultTimeZoneStorageStrategy() == TimeZoneStorageStrategy.NORMALIZE

View File

@ -16,7 +16,7 @@ import org.hibernate.engine.jdbc.internal.CharacterStreamImpl;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
/**
@ -42,7 +42,7 @@ public class StringJavaTypeDescriptor extends AbstractClassJavaTypeDescriptor<St
@Override
public JdbcType getRecommendedJdbcType(JdbcTypeDescriptorIndicators stdIndicators) {
final TypeConfiguration typeConfiguration = stdIndicators.getTypeConfiguration();
final JdbcTypeDescriptorRegistry stdRegistry = typeConfiguration.getJdbcTypeDescriptorRegistry();
final JdbcTypeRegistry stdRegistry = typeConfiguration.getJdbcTypeDescriptorRegistry();
if ( stdIndicators.isLob() ) {
return stdIndicators.isNationalized()

View File

@ -26,7 +26,7 @@ import org.hibernate.internal.util.ZonedDateTimeComparator;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
/**
@ -53,7 +53,7 @@ public class ZonedDateTimeJavaTypeDescriptor extends AbstractTemporalJavaTypeDes
@Override
public JdbcType getRecommendedJdbcType(JdbcTypeDescriptorIndicators stdIndicators) {
final TemporalType temporalPrecision = stdIndicators.getTemporalPrecision();
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = stdIndicators.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = stdIndicators.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
if ( temporalPrecision == null || temporalPrecision == TemporalType.TIMESTAMP ) {
return stdIndicators.getDefaultTimeZoneStorageStrategy() == TimeZoneStorageStrategy.NORMALIZE

View File

@ -73,15 +73,27 @@ import org.hibernate.type.descriptor.java.ZoneOffsetJavaTypeDescriptor;
import org.hibernate.type.descriptor.java.ZonedDateTimeJavaTypeDescriptor;
/**
*
* @author Steve Ebersole
* Primes the {@link BaselineTarget} (which is essentially the {@link JavaTypeRegistry})
* with Hibernate's baseline {@link JavaType} registrations
*/
public class JavaTypeDescriptorBaseline {
/**
* The target of the baseline registrations
*/
public interface BaselineTarget {
/**
* Add a baseline registration
*/
void addBaselineDescriptor(JavaType<?> descriptor);
/**
* Add a baseline registration
*/
void addBaselineDescriptor(Type describedJavaType, JavaType<?> descriptor);
}
/**
* The process of registering all the baseline registrations
*/
@SuppressWarnings("unchecked")
public static void prime(BaselineTarget target) {
primePrimitive( target, ByteJavaTypeDescriptor.INSTANCE );
@ -134,6 +146,13 @@ public class JavaTypeDescriptorBaseline {
target.addBaselineDescriptor( UUIDJavaTypeDescriptor.INSTANCE );
target.addBaselineDescriptor( InetAddressJavaTypeDescriptor.INSTANCE );
registerCollectionTypes( target );
target.addBaselineDescriptor( MapEntryJavaDescriptor.INSTANCE );
}
@SuppressWarnings({ "unchecked", "rawtypes" })
private static void registerCollectionTypes(BaselineTarget target) {
target.addBaselineDescriptor( new CollectionJavaTypeDescriptor( Collection.class, StandardBagSemantics.INSTANCE ) );
target.addBaselineDescriptor( new CollectionJavaTypeDescriptor( Object[].class, StandardArraySemantics.INSTANCE ) );
target.addBaselineDescriptor( new CollectionJavaTypeDescriptor( List.class, StandardListSemantics.INSTANCE ) );
@ -148,8 +167,6 @@ public class JavaTypeDescriptorBaseline {
target.addBaselineDescriptor( new CollectionJavaTypeDescriptor( SortedMap.class, StandardSortedMapSemantics.INSTANCE ) );
target.addBaselineDescriptor( new CollectionJavaTypeDescriptor( TreeMap.class, StandardSortedMapSemantics.INSTANCE ) );
target.addBaselineDescriptor( new CollectionJavaTypeDescriptor( LinkedHashMap.class, StandardOrderedMapSemantics.INSTANCE ) );
target.addBaselineDescriptor( MapEntryJavaDescriptor.INSTANCE );
}
private static void primePrimitive(BaselineTarget target, JavaType descriptor) {

View File

@ -28,13 +28,13 @@ import org.jboss.logging.Logger;
*
* @since 5.3
*/
public class JavaTypeDescriptorRegistry implements JavaTypeDescriptorBaseline.BaselineTarget, Serializable {
private static final Logger log = Logger.getLogger( JavaTypeDescriptorRegistry.class );
public class JavaTypeRegistry implements JavaTypeDescriptorBaseline.BaselineTarget, Serializable {
private static final Logger log = Logger.getLogger( JavaTypeRegistry.class );
private final TypeConfiguration typeConfiguration;
private final ConcurrentHashMap<Type, JavaType<?>> descriptorsByType = new ConcurrentHashMap<>();
public JavaTypeDescriptorRegistry(TypeConfiguration typeConfiguration) {
public JavaTypeRegistry(TypeConfiguration typeConfiguration) {
this.typeConfiguration = typeConfiguration;
JavaTypeDescriptorBaseline.prime( this );
}
@ -103,7 +103,7 @@ public class JavaTypeDescriptorRegistry implements JavaTypeDescriptorBaseline.Ba
JavaType<?> old = descriptorsByType.put( descriptor.getJavaType(), descriptor );
if ( old != null ) {
log.debugf(
"JavaTypeDescriptorRegistry entry replaced : %s -> %s (was %s)",
"JavaTypeRegistry entry replaced : %s -> %s (was %s)",
descriptor.getJavaType(),
descriptor,
old

View File

@ -9,7 +9,7 @@ package org.hibernate.type.descriptor.jdbc;
import java.sql.Types;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
/**
@ -41,7 +41,7 @@ public class CharJdbcType extends VarcharJdbcType {
assert domainJtd != null;
final TypeConfiguration typeConfiguration = indicators.getTypeConfiguration();
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = typeConfiguration.getJdbcTypeDescriptorRegistry();
final JdbcTypeRegistry jdbcTypeRegistry = typeConfiguration.getJdbcTypeDescriptorRegistry();
final int jdbcTypeCode;
if ( indicators.isLob() ) {

View File

@ -18,7 +18,7 @@ import org.hibernate.type.descriptor.ValueBinder;
import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
/**
@ -48,7 +48,7 @@ public abstract class ClobJdbcType implements AdjustableJdbcType {
JdbcTypeDescriptorIndicators indicators,
JavaType<?> domainJtd) {
final TypeConfiguration typeConfiguration = indicators.getTypeConfiguration();
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = typeConfiguration.getJdbcTypeDescriptorRegistry();
final JdbcTypeRegistry jdbcTypeRegistry = typeConfiguration.getJdbcTypeDescriptorRegistry();
return indicators.isNationalized()
? jdbcTypeRegistry.getDescriptor( Types.NCLOB )
: jdbcTypeRegistry.getDescriptor( Types.CLOB );

View File

@ -12,7 +12,7 @@ import jakarta.persistence.TemporalType;
import org.hibernate.TimeZoneStorageStrategy;
import org.hibernate.type.descriptor.java.BasicJavaType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
/**
@ -66,7 +66,7 @@ public interface JdbcTypeDescriptorIndicators {
* When mapping a boolean type to the database what is the preferred SQL type code to use?
* <p/>
* Specifically names the key into the
* {@link JdbcTypeDescriptorRegistry}.
* {@link JdbcTypeRegistry}.
*/
default int getPreferredSqlTypeCodeForBoolean() {
return Types.BOOLEAN;

View File

@ -9,7 +9,7 @@ package org.hibernate.type.descriptor.jdbc;
import java.sql.Types;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
/**
@ -40,7 +40,7 @@ public class LongNVarcharJdbcType extends NVarcharJdbcType {
assert domainJtd != null;
final TypeConfiguration typeConfiguration = indicators.getTypeConfiguration();
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = typeConfiguration.getJdbcTypeDescriptorRegistry();
final JdbcTypeRegistry jdbcTypeRegistry = typeConfiguration.getJdbcTypeDescriptorRegistry();
final int jdbcTypeCode;
if ( indicators.isLob() ) {

View File

@ -9,7 +9,7 @@ package org.hibernate.type.descriptor.jdbc;
import java.sql.Types;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
/**
@ -40,7 +40,7 @@ public class LongVarcharJdbcType extends VarcharJdbcType {
assert domainJtd != null;
final TypeConfiguration typeConfiguration = indicators.getTypeConfiguration();
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = typeConfiguration.getJdbcTypeDescriptorRegistry();
final JdbcTypeRegistry jdbcTypeRegistry = typeConfiguration.getJdbcTypeDescriptorRegistry();
final int jdbcTypeCode;
if ( indicators.isLob() ) {

View File

@ -9,7 +9,7 @@ package org.hibernate.type.descriptor.jdbc;
import java.sql.Types;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
/**
@ -40,7 +40,7 @@ public class NCharJdbcType extends NVarcharJdbcType {
assert domainJtd != null;
final TypeConfiguration typeConfiguration = indicators.getTypeConfiguration();
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = typeConfiguration.getJdbcTypeDescriptorRegistry();
final JdbcTypeRegistry jdbcTypeRegistry = typeConfiguration.getJdbcTypeDescriptorRegistry();
final int jdbcTypeCode;
if ( indicators.isLob() ) {

View File

@ -18,7 +18,7 @@ import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.BasicJavaType;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.jdbc.internal.JdbcLiteralFormatterCharacterData;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
/**
@ -71,7 +71,7 @@ public class NVarcharJdbcType implements AdjustableJdbcType {
assert domainJtd != null;
final TypeConfiguration typeConfiguration = indicators.getTypeConfiguration();
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = typeConfiguration.getJdbcTypeDescriptorRegistry();
final JdbcTypeRegistry jdbcTypeRegistry = typeConfiguration.getJdbcTypeDescriptorRegistry();
final int jdbcTypeCode;
if ( indicators.isLob() ) {

View File

@ -18,7 +18,7 @@ import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.BasicJavaType;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.jdbc.internal.JdbcLiteralFormatterBinary;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
/**
@ -70,7 +70,7 @@ public class VarbinaryJdbcType implements AdjustableJdbcType {
@Override
public JdbcType resolveIndicatedType(JdbcTypeDescriptorIndicators indicators, JavaType<?> domainJtd) {
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = indicators.getTypeConfiguration().getJdbcTypeDescriptorRegistry();
final JdbcTypeRegistry jdbcTypeRegistry = indicators.getTypeConfiguration().getJdbcTypeDescriptorRegistry();
return indicators.isLob()
? jdbcTypeRegistry.getDescriptor( Types.BLOB )
: this;

View File

@ -18,7 +18,7 @@ import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.BasicJavaType;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.jdbc.internal.JdbcLiteralFormatterCharacterData;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
/**
@ -71,7 +71,7 @@ public class VarcharJdbcType implements AdjustableJdbcType {
assert domainJtd != null;
final TypeConfiguration typeConfiguration = indicators.getTypeConfiguration();
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = typeConfiguration.getJdbcTypeDescriptorRegistry();
final JdbcTypeRegistry jdbcTypeRegistry = typeConfiguration.getJdbcTypeDescriptorRegistry();
final int jdbcTypeCode;
if ( indicators.isLob() ) {

View File

@ -38,7 +38,7 @@ import org.hibernate.type.descriptor.jdbc.VarcharJdbcType;
*
* @author Chris Cranford
*/
public class JdbcTypeDescriptorBaseline {
public class JdbcTypeBaseline {
public interface BaselineTarget {
void addDescriptor(JdbcType descriptor);
void addDescriptor(int code, JdbcType descriptor);

View File

@ -13,7 +13,7 @@ import org.hibernate.type.descriptor.JdbcTypeNameMapper;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.JdbcTypeFamilyInformation;
import org.hibernate.type.descriptor.jdbc.ObjectJdbcType;
import org.hibernate.type.descriptor.jdbc.internal.JdbcTypeDescriptorBaseline;
import org.hibernate.type.descriptor.jdbc.internal.JdbcTypeBaseline;
import org.hibernate.type.spi.TypeConfiguration;
import org.jboss.logging.Logger;
@ -26,14 +26,14 @@ import org.jboss.logging.Logger;
*
* @since 5.3
*/
public class JdbcTypeDescriptorRegistry implements JdbcTypeDescriptorBaseline.BaselineTarget, Serializable {
private static final Logger log = Logger.getLogger( JdbcTypeDescriptorRegistry.class );
public class JdbcTypeRegistry implements JdbcTypeBaseline.BaselineTarget, Serializable {
private static final Logger log = Logger.getLogger( JdbcTypeRegistry.class );
private final ConcurrentHashMap<Integer, JdbcType> descriptorMap = new ConcurrentHashMap<>();
public JdbcTypeDescriptorRegistry(TypeConfiguration typeConfiguration) {
public JdbcTypeRegistry(TypeConfiguration typeConfiguration) {
// this.typeConfiguration = typeConfiguration;
JdbcTypeDescriptorBaseline.prime( this );
JdbcTypeBaseline.prime( this );
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -57,10 +57,10 @@ import org.hibernate.type.BasicTypeRegistry;
import org.hibernate.type.SqlTypes;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.internal.BasicTypeImpl;
import java.sql.Time;
@ -99,8 +99,8 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// things available during both boot and runtime lifecycle phases
private final transient JavaTypeDescriptorRegistry javaTypeDescriptorRegistry;
private final transient JdbcTypeDescriptorRegistry jdbcTypeDescriptorRegistry;
private final transient JavaTypeRegistry javaTypeRegistry;
private final transient JdbcTypeRegistry jdbcTypeRegistry;
private final transient BasicTypeRegistry basicTypeRegistry;
private final transient Map<Integer, Set<String>> jdbcToHibernateTypeContributionMap = new HashMap<>();
@ -108,8 +108,8 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable {
public TypeConfiguration() {
this.scope = new Scope( this );
this.javaTypeDescriptorRegistry = new JavaTypeDescriptorRegistry( this );
this.jdbcTypeDescriptorRegistry = new JdbcTypeDescriptorRegistry( this );
this.javaTypeRegistry = new JavaTypeRegistry( this );
this.jdbcTypeRegistry = new JdbcTypeRegistry( this );
this.basicTypeRegistry = new BasicTypeRegistry( this );
StandardBasicTypes.prime( this );
@ -124,12 +124,12 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable {
}
public JavaTypeDescriptorRegistry getJavaTypeDescriptorRegistry() {
return javaTypeDescriptorRegistry;
public JavaTypeRegistry getJavaTypeDescriptorRegistry() {
return javaTypeRegistry;
}
public JdbcTypeDescriptorRegistry getJdbcTypeDescriptorRegistry() {
return jdbcTypeDescriptorRegistry;
public JdbcTypeRegistry getJdbcTypeDescriptorRegistry() {
return jdbcTypeRegistry;
}
public JdbcTypeDescriptorIndicators getCurrentBaseSqlTypeIndicators() {
@ -232,7 +232,7 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable {
basicTypeRegistration.getRegistrationKeys()
);
javaTypeDescriptorRegistry.resolveDescriptor(
javaTypeRegistry.resolveDescriptor(
basicType.getJavaType(),
() -> basicType.getJavaTypeDescriptor()
);
@ -308,7 +308,7 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable {
final ClassLoaderService cls = getServiceRegistry().getService( ClassLoaderService.class );
final Class<?> javaTypeClass = cls.classForName( name );
final JavaType<?> jtd = javaTypeDescriptorRegistry.resolveDescriptor( javaTypeClass );
final JavaType<?> jtd = javaTypeRegistry.resolveDescriptor( javaTypeClass );
final JdbcType jdbcType = jtd.getRecommendedJdbcType( getCurrentBaseSqlTypeIndicators() );
return basicTypeRegistry.resolve( jtd, jdbcType );
}
@ -657,7 +657,7 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable {
}
// otherwise, apply the creator
final JavaType<J> javaTypeDescriptor = javaTypeDescriptorRegistry.resolveDescriptor( javaType );
final JavaType<J> javaTypeDescriptor = javaTypeRegistry.resolveDescriptor( javaType );
return creator.apply( javaTypeDescriptor );
}
);

View File

@ -30,7 +30,7 @@ import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.TinyIntJdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.DomainModelScope;
@ -54,7 +54,7 @@ public class JdbcTypeTests {
final MetadataImplementor domainModel = scope.getDomainModel();
final Dialect dialect = domainModel.getDatabase().getDialect();
final NationalizationSupport nationalizationSupport = dialect.getNationalizationSupport();
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
final PersistentClass entityBinding = domainModel.getEntityBinding( SimpleEntity.class.getName() );

View File

@ -18,7 +18,7 @@ import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.TinyIntJdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.DomainModelScope;
@ -46,7 +46,7 @@ public class ListIndexJdbcTypeTests {
public void verifyResolutions(DomainModelScope scope) {
final MetadataImplementor domainModel = scope.getDomainModel();
final PersistentClass entityBinding = domainModel.getEntityBinding( TheEntity.class.getName() );
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
verifyJdbcTypeCodes( entityBinding.getProperty( "listOfStrings" ), Types.TINYINT );

View File

@ -22,7 +22,7 @@ import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.TinyIntJdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.DomainModelScope;
@ -50,7 +50,7 @@ public class MapKeyJdbcTypeTests {
final MetadataImplementor domainModel = scope.getDomainModel();
final Dialect dialect = domainModel.getDatabase().getDialect();
final NationalizationSupport nationalizationSupport = dialect.getNationalizationSupport();
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = domainModel.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
final PersistentClass entityBinding = domainModel.getEntityBinding( MyEntity.class.getName() );

View File

@ -30,7 +30,7 @@ import org.hibernate.metamodel.model.convert.internal.OrdinalEnumValueConverter;
import org.hibernate.metamodel.model.convert.spi.BasicValueConverter;
import org.hibernate.metamodel.model.convert.spi.JpaAttributeConverter;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.ServiceRegistry;
@ -63,7 +63,7 @@ public class SmokeTests {
final EntityPersister entityDescriptor = scope.getSessionFactory()
.getDomainModel()
.getEntityDescriptor( SimpleEntity.class );
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = entityDescriptor.getFactory()
final JdbcTypeRegistry jdbcTypeRegistry = entityDescriptor.getFactory()
.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();

View File

@ -19,7 +19,7 @@ import org.hibernate.query.spi.QueryImplementor;
import org.hibernate.type.descriptor.java.CoercionException;
import org.hibernate.type.descriptor.java.CoercionHelper;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
import org.hibernate.testing.orm.junit.DomainModel;
@ -53,7 +53,7 @@ public class CoercionTests {
@Test
public void testCoercibleDetection(SessionFactoryScope scope) {
final TypeConfiguration typeConfiguration = scope.getSessionFactory().getTypeConfiguration();
final JavaTypeDescriptorRegistry jtdRegistry = typeConfiguration.getJavaTypeDescriptorRegistry();
final JavaTypeRegistry jtdRegistry = typeConfiguration.getJavaTypeDescriptorRegistry();
final JavaType<Integer> integerType = jtdRegistry.resolveDescriptor( Integer.class );
final JavaType<Long> longType = jtdRegistry.resolveDescriptor( Long.class );

View File

@ -12,7 +12,7 @@ import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.MutabilityPlan;
import org.hibernate.type.descriptor.java.StringJavaTypeDescriptor;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators;
import org.hibernate.type.spi.TypeConfiguration;
@ -25,12 +25,12 @@ import static org.junit.Assert.assertThat;
/**
* @author Andrea Boriero
*/
public class JavaTypeDescriptorRegistryTest {
public class JavaTypeRegistryTest {
@Test
public void testGetJavaTypeDescriptorRegistry() {
final TypeConfiguration typeConfiguration = new TypeConfiguration();
final JavaTypeDescriptorRegistry registry = new JavaTypeDescriptorRegistry( typeConfiguration );
final JavaTypeRegistry registry = new JavaTypeRegistry( typeConfiguration );
final JavaType<String> descriptor = registry.getDescriptor( String.class );
@ -40,7 +40,7 @@ public class JavaTypeDescriptorRegistryTest {
@Test
public void testRegisterJavaTypeDescriptorRegistry(){
final TypeConfiguration typeConfiguration = new TypeConfiguration();
final JavaTypeDescriptorRegistry registry = new JavaTypeDescriptorRegistry( typeConfiguration );
final JavaTypeRegistry registry = new JavaTypeRegistry( typeConfiguration );
registry.addDescriptor( new CustomJavaType() );

View File

@ -27,7 +27,7 @@ import org.hibernate.type.descriptor.java.CharacterArrayJavaTypeDescriptor;
import org.hibernate.type.descriptor.java.CharacterJavaTypeDescriptor;
import org.hibernate.type.descriptor.java.NClobJavaTypeDescriptor;
import org.hibernate.type.descriptor.java.StringJavaTypeDescriptor;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.testing.orm.junit.BaseUnitTest;
import org.junit.jupiter.api.Test;
@ -78,7 +78,7 @@ public class SimpleNationalizedTest {
ms.addAnnotatedClass( NationalizedEntity.class );
final Metadata metadata = ms.buildMetadata();
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = metadata.getDatabase()
final JdbcTypeRegistry jdbcTypeRegistry = metadata.getDatabase()
.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
PersistentClass pc = metadata.getEntityBinding( NationalizedEntity.class.getName() );

View File

@ -25,7 +25,7 @@ import org.hibernate.mapping.Property;
import org.hibernate.type.BasicType;
import org.hibernate.type.descriptor.java.CharacterJavaTypeDescriptor;
import org.hibernate.type.descriptor.java.StringJavaTypeDescriptor;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseUnitTestCase;
@ -53,7 +53,7 @@ public class UseNationalizedCharDataSettingTest extends BaseUnitTestCase {
ms.addAnnotatedClass( NationalizedBySettingEntity.class );
final Metadata metadata = ms.buildMetadata();
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = metadata.getDatabase()
final JdbcTypeRegistry jdbcTypeRegistry = metadata.getDatabase()
.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
final PersistentClass pc = metadata.getEntityBinding( NationalizedBySettingEntity.class.getName() );
@ -86,7 +86,7 @@ public class UseNationalizedCharDataSettingTest extends BaseUnitTestCase {
ms.addAnnotatedClass( NationalizedBySettingEntity.class );
final Metadata metadata = ms.buildMetadata();
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = metadata.getDatabase()
final JdbcTypeRegistry jdbcTypeRegistry = metadata.getDatabase()
.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
final PersistentClass pc = metadata.getEntityBinding( NationalizedBySettingEntity.class.getName() );

View File

@ -36,7 +36,7 @@ import org.hibernate.sql.results.graph.DomainResultAssembler;
import org.hibernate.sql.results.graph.basic.BasicResult;
import org.hibernate.sql.results.graph.basic.BasicResultAssembler;
import org.hibernate.sql.results.internal.SqlSelectionImpl;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.internal.BasicTypeImpl;
import org.hibernate.testing.hamcrest.AssignableMatcher;
@ -131,7 +131,7 @@ public class SmokeTests {
public void testConvertedHqlInterpretation(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = session.getFactory()
final JdbcTypeRegistry jdbcTypeRegistry = session.getFactory()
.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
final QueryImplementor<Gender> query = session.createQuery( "select e.gender from SimpleEntity e", Gender.class );

View File

@ -27,7 +27,7 @@ import org.hibernate.mapping.PersistentClass;
import org.hibernate.type.BasicType;
import org.hibernate.type.BasicTypeReference;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseUnitTestCase;
@ -106,7 +106,7 @@ public class OracleLongLobTypeTest extends BaseUnitTestCase {
mappings.validate();
final PersistentClass entityBinding = mappings.getEntityBinding( entityClass.getName() );
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = mappings.getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = mappings.getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
BasicType<?> type;

View File

@ -17,7 +17,7 @@ import org.hibernate.dialect.SybaseDialect;
import org.hibernate.type.descriptor.jdbc.BlobJdbcType;
import org.hibernate.type.descriptor.jdbc.IntegerJdbcType;
import org.hibernate.type.descriptor.jdbc.VarbinaryJdbcType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.testing.orm.junit.BaseSessionFactoryFunctionalTest;
import org.hibernate.testing.orm.junit.SkipForDialect;
@ -47,7 +47,7 @@ public class TypeOverrideTest extends BaseSessionFactoryFunctionalTest {
@Test
public void testStandardBasicSqlTypeDescriptor() {
final Dialect dialect = getMetadata().getDatabase().getDialect();
final JdbcTypeDescriptorRegistry jdbcTypeRegistry = getMetadata().getTypeConfiguration()
final JdbcTypeRegistry jdbcTypeRegistry = getMetadata().getTypeConfiguration()
.getJdbcTypeDescriptorRegistry();
// no override
assertSame( IntegerJdbcType.INSTANCE, jdbcTypeRegistry.getDescriptor( Types.INTEGER ) );

View File

@ -142,7 +142,7 @@ public class LongListTypeContributorTest extends BaseEntityManagerFunctionalTest
@Override
public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
// JavaTypeDescriptorRegistry.INSTANCE.addDescriptor( StringifiedCollectionJavaTypeDescriptor.INSTANCE );
// JavaTypeRegistry.INSTANCE.addDescriptor( StringifiedCollectionJavaTypeDescriptor.INSTANCE );
typeContributions.contributeType( StringifiedCollectionType.INSTANCE );
}