diff --git a/documentation/src/main/asciidoc/userguide/chapters/domain/basic_types.adoc b/documentation/src/main/asciidoc/userguide/chapters/domain/basic_types.adoc index a8c69e2b78..dbc2815053 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/domain/basic_types.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/domain/basic_types.adoc @@ -1298,25 +1298,180 @@ For details, see the discussion of generators in <>. 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 <>. -`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 <> for discussion of `JavaTypeRegistry`. + +See <> 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 <> for more discussion. +==== + +Customizing the `JdbcTypeRegistry` can be accomplished through `@JdbcTypeRegistration` and +`TypeContributor`. See <> for discussion of `JavaTypeRegistry`. +See <> for discussion of `TypeContributor`. + +See the `@JdbcTypeCode` Javadoc for details. + +See <> 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 <> for one case where +this can manifest. See also <> 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 <> 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 <>. + +See <> 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 <> 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 <>, <>, <> and <> + See <> 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 <> and <>. + + + + + + + + + + + + @@ -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 <>. 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 +<>, 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 <> 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 <> or <> instead. +==== + + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [[basic-bitset]] diff --git a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/BigDecimalMappingTests.java b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/BigDecimalMappingTests.java index 29334a6ec4..5eb55754e6 100644 --- a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/BigDecimalMappingTests.java +++ b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/BigDecimalMappingTests.java @@ -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(); { diff --git a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/BigIntegerMappingTests.java b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/BigIntegerMappingTests.java index 1742a4c8bb..9f2cd0ef18 100644 --- a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/BigIntegerMappingTests.java +++ b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/BigIntegerMappingTests.java @@ -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(); { diff --git a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/ByteMappingTests.java b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/ByteMappingTests.java index d6c1b12ed7..08dbd0c1b6 100644 --- a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/ByteMappingTests.java +++ b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/ByteMappingTests.java @@ -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(); { diff --git a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/CharacterArrayNationalizedMappingTests.java b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/CharacterArrayNationalizedMappingTests.java index f30de2125c..95cdc11334 100644 --- a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/CharacterArrayNationalizedMappingTests.java +++ b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/CharacterArrayNationalizedMappingTests.java @@ -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(); diff --git a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/DurationMappingTests.java b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/DurationMappingTests.java index 482603fff6..7f1af51280 100644 --- a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/DurationMappingTests.java +++ b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/DurationMappingTests.java @@ -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" ); diff --git a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/StringNationalizedMappingTests.java b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/StringNationalizedMappingTests.java index eb208ffcbe..895b726b70 100644 --- a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/StringNationalizedMappingTests.java +++ b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/StringNationalizedMappingTests.java @@ -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(); diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/CUBRIDDialect.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/CUBRIDDialect.java index e0eff44fbc..a3b1b9271c 100644 --- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/CUBRIDDialect.java +++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/CUBRIDDialect.java @@ -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 ); } diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/CacheDialect.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/CacheDialect.java index 6a5ee2d354..31eaf2f7df 100644 --- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/CacheDialect.java +++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/CacheDialect.java @@ -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 ); } diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/FirebirdDialect.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/FirebirdDialect.java index eed3132a48..902d0d2be4 100644 --- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/FirebirdDialect.java +++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/FirebirdDialect.java @@ -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 ); } diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/IngresDialect.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/IngresDialect.java index dbfe7f6a84..ebfd0de804 100644 --- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/IngresDialect.java +++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/IngresDialect.java @@ -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 ); } diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/MaxDBDialect.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/MaxDBDialect.java index 38065ef648..7b14acbe06 100644 --- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/MaxDBDialect.java +++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/MaxDBDialect.java @@ -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 ); } diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/RDMSOS2200Dialect.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/RDMSOS2200Dialect.java index 998b8d12b7..26cb808492 100644 --- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/RDMSOS2200Dialect.java +++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/RDMSOS2200Dialect.java @@ -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 ); } diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SQLiteDialect.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SQLiteDialect.java index f037ace116..605b3a00cc 100644 --- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SQLiteDialect.java +++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SQLiteDialect.java @@ -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 ); diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TeradataDialect.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TeradataDialect.java index c0e2c74870..670b3bcc97 100644 --- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TeradataDialect.java +++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TeradataDialect.java @@ -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 ); } diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TimesTenDialect.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TimesTenDialect.java index 104ee1d8ee..3754f4f0ff 100644 --- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TimesTenDialect.java +++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TimesTenDialect.java @@ -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 ); } diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/AnyKeyJavaClass.java b/hibernate-core/src/main/java/org/hibernate/annotations/AnyKeyJavaClass.java index fed8ebe73a..7f55c3cbb8 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/AnyKeyJavaClass.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/AnyKeyJavaClass.java @@ -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 diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/JdbcTypeCode.java b/hibernate-core/src/main/java/org/hibernate/annotations/JdbcTypeCode.java index 54618a73f5..3d0a26850e 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/JdbcTypeCode.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/JdbcTypeCode.java @@ -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 diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/JdbcTypeRegistration.java b/hibernate-core/src/main/java/org/hibernate/annotations/JdbcTypeRegistration.java index 74da506f3a..c77bb616a9 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/JdbcTypeRegistration.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/JdbcTypeRegistration.java @@ -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. diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/TypeContributions.java b/hibernate-core/src/main/java/org/hibernate/boot/model/TypeContributions.java index bd8c4b5276..7ed5f45ec1 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/TypeContributions.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/TypeContributions.java @@ -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); /** diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/convert/spi/JpaAttributeConverterCreationContext.java b/hibernate-core/src/main/java/org/hibernate/boot/model/convert/spi/JpaAttributeConverterCreationContext.java index 69c5e61aff..b1fd0e997f 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/convert/spi/JpaAttributeConverterCreationContext.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/convert/spi/JpaAttributeConverterCreationContext.java @@ -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(); } } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/InferredBasicValueResolver.java b/hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/InferredBasicValueResolver.java index fb8d9aa4ff..c7b4588639 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/InferredBasicValueResolver.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/InferredBasicValueResolver.java @@ -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 ) ) { diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/process/spi/MetadataBuildingProcess.java b/hibernate-core/src/main/java/org/hibernate/boot/model/process/spi/MetadataBuildingProcess.java index d35f7ebc40..1a4fc7df5a 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/process/spi/MetadataBuildingProcess.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/process/spi/MetadataBuildingProcess.java @@ -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 customType = (CustomType) 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 ) ) { diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/AbstractHANADialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/AbstractHANADialect.java index d2ecf6596e..3cc11e0cbf 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/AbstractHANADialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/AbstractHANADialect.java @@ -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() ); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java index c47029aee4..c985404267 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java @@ -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 ); } diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/CockroachDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/CockroachDialect.java index 312b4988f9..39de6ab3af 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/CockroachDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/CockroachDialect.java @@ -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 ); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/DB2Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/DB2Dialect.java index ec7a9c84a2..4749bce586 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/DB2Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/DB2Dialect.java @@ -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 ) { diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/DerbyDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/DerbyDialect.java index 3288e0ed8d..f8d6ca03cb 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/DerbyDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/DerbyDialect.java @@ -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 ); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java index 701fac4a02..4d8f870353 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java @@ -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( diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/H2Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/H2Dialect.java index 1188017e0d..49db897b4b 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/H2Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/H2Dialect.java @@ -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 ); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/MySQLDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/MySQLDialect.java index a363418059..60752eaca9 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/MySQLDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/MySQLDialect.java @@ -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) { diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/OracleDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/OracleDialect.java index b53ca4187f..892576b7ac 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/OracleDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/OracleDialect.java @@ -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 ); } diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java index 08b8595eb9..8c4ac90103 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java @@ -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 // http://jdbc.postgresql.org/documentation/84/binary-data.html. diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/SybaseASEDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/SybaseASEDialect.java index 0a4ddf43eb..61d1f3685f 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/SybaseASEDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/SybaseASEDialect.java @@ -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 diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/SybaseDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/SybaseDialect.java index 679a33ed8c..de741dfed9 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/SybaseDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/SybaseDialect.java @@ -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 ); diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/BasicValue.java b/hibernate-core/src/main/java/org/hibernate/mapping/BasicValue.java index 2720f971f8..2166877e00 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/BasicValue.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/BasicValue.java @@ -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 ); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AttributeFactory.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AttributeFactory.java index ae12b00069..b79e372445 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AttributeFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AttributeFactory.java @@ -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
    @@ -257,7 +257,7 @@ public class AttributeFactory { return cached; } - final JavaTypeDescriptorRegistry registry = context.getTypeConfiguration() + final JavaTypeRegistry registry = context.getTypeConfiguration() .getJavaTypeDescriptorRegistry(); final JavaType javaTypeDescriptor = registry.resolveManagedTypeDescriptor( embeddableClass ); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EntityRepresentationStrategyPojoStandard.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EntityRepresentationStrategyPojoStandard.java index 1e136cf44c..c80366a5ad 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EntityRepresentationStrategyPojoStandard.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EntityRepresentationStrategyPojoStandard.java @@ -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(); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetadataContext.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetadataContext.java index 56bf8f1c7a..204b23d6d1 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetadataContext.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetadataContext.java @@ -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 ) ); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/AbstractDiscriminatorMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/AbstractDiscriminatorMapping.java index 0b4bb684fa..7215a96296 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/AbstractDiscriminatorMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/AbstractDiscriminatorMapping.java @@ -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 domainJtd; final Function entityNameHandler; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/MappingModelCreationHelper.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/MappingModelCreationHelper.java index 7ce6446c7a..b18b1b8cda 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/MappingModelCreationHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/MappingModelCreationHelper.java @@ -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 baseJtd = jtdRegistry.getDescriptor(Object.class); return new DiscriminatedCollectionPart( diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/Converters.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/Converters.java index 0993ad3b4f..3dc321b9c1 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/Converters.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/Converters.java @@ -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> converterBean = beanRegistry.getBean( converterClass ); final TypeConfiguration typeConfiguration = sfi.getTypeConfiguration(); - final JavaTypeDescriptorRegistry jtdRegistry = typeConfiguration.getJavaTypeDescriptorRegistry(); + final JavaTypeRegistry jtdRegistry = typeConfiguration.getJavaTypeDescriptorRegistry(); final JavaType> converterJtd = jtdRegistry.getDescriptor( converterClass ); return new JpaAttributeConverterImpl<>( converterBean, converterJtd, domainJtd, relationalJtd ); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/internal/JpaAttributeConverterImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/internal/JpaAttributeConverterImpl.java index 279d036e18..e5f5d9fdfe 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/internal/JpaAttributeConverterImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/internal/JpaAttributeConverterImpl.java @@ -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 implements JpaAttributeConverter 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 ) ); diff --git a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/BasicDotIdentifierConsumer.java b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/BasicDotIdentifierConsumer.java index 28f319e7d6..cdf2d14125 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/BasicDotIdentifierConsumer.java +++ b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/BasicDotIdentifierConsumer.java @@ -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() ); diff --git a/hibernate-core/src/main/java/org/hibernate/query/internal/ResultMementoBasicStandard.java b/hibernate-core/src/main/java/org/hibernate/query/internal/ResultMementoBasicStandard.java index dd83593f8d..bdd13fbfb0 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/internal/ResultMementoBasicStandard.java +++ b/hibernate-core/src/main/java/org/hibernate/query/internal/ResultMementoBasicStandard.java @@ -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 registeredJtd = jtdRegistry.getDescriptor( definition.type() ); final ManagedBeanRegistry beanRegistry = sessionFactory.getServiceRegistry().getService( ManagedBeanRegistry.class ); if ( BasicType.class.isAssignableFrom( registeredJtd.getJavaTypeClass() ) ) { diff --git a/hibernate-core/src/main/java/org/hibernate/query/results/dynamic/DynamicResultBuilderBasicConverted.java b/hibernate-core/src/main/java/org/hibernate/query/results/dynamic/DynamicResultBuilderBasicConverted.java index 07f1bdab16..fdd1879dc3 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/results/dynamic/DynamicResultBuilderBasicConverted.java +++ b/hibernate-core/src/main/java/org/hibernate/query/results/dynamic/DynamicResultBuilderBasicConverted.java @@ -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 implements DynamicResultBui AttributeConverter 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 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 ); diff --git a/hibernate-core/src/main/java/org/hibernate/result/internal/OutputsImpl.java b/hibernate-core/src/main/java/org/hibernate/result/internal/OutputsImpl.java index 524fb3e7a8..c70678737d 100644 --- a/hibernate-core/src/main/java/org/hibernate/result/internal/OutputsImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/result/internal/OutputsImpl.java @@ -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 ) ); diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/ClobJavaTypeDescriptor.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/ClobJavaTypeDescriptor.java index f559d8fbae..9ec1b369d4 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/ClobJavaTypeDescriptor.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/ClobJavaTypeDescriptor.java @@ -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 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) { diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/JavaTypeDescriptorRegistry.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/JavaTypeRegistry.java similarity index 94% rename from hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/JavaTypeDescriptorRegistry.java rename to hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/JavaTypeRegistry.java index 4aca46fdff..5b5b67a585 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/JavaTypeDescriptorRegistry.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/JavaTypeRegistry.java @@ -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> 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 diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/CharJdbcType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/CharJdbcType.java index 54d6559f9a..5221aac4eb 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/CharJdbcType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/CharJdbcType.java @@ -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() ) { diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/ClobJdbcType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/ClobJdbcType.java index bcb4147fff..24927d89a8 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/ClobJdbcType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/ClobJdbcType.java @@ -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 ); diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/JdbcTypeDescriptorIndicators.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/JdbcTypeDescriptorIndicators.java index aa073bfa96..8be99ac60e 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/JdbcTypeDescriptorIndicators.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/JdbcTypeDescriptorIndicators.java @@ -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? *

    * Specifically names the key into the - * {@link JdbcTypeDescriptorRegistry}. + * {@link JdbcTypeRegistry}. */ default int getPreferredSqlTypeCodeForBoolean() { return Types.BOOLEAN; diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/LongNVarcharJdbcType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/LongNVarcharJdbcType.java index 7a432f80d9..36906113df 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/LongNVarcharJdbcType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/LongNVarcharJdbcType.java @@ -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() ) { diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/LongVarcharJdbcType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/LongVarcharJdbcType.java index 689a150426..a9d3fc162e 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/LongVarcharJdbcType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/LongVarcharJdbcType.java @@ -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() ) { diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/NCharJdbcType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/NCharJdbcType.java index 143a669599..7c7b2cb5cf 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/NCharJdbcType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/NCharJdbcType.java @@ -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() ) { diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/NVarcharJdbcType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/NVarcharJdbcType.java index 6e46ee9b3f..eebfff2f1d 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/NVarcharJdbcType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/NVarcharJdbcType.java @@ -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() ) { diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/VarbinaryJdbcType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/VarbinaryJdbcType.java index 40b62bc2c5..f0ea07ee8c 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/VarbinaryJdbcType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/VarbinaryJdbcType.java @@ -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; diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/VarcharJdbcType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/VarcharJdbcType.java index a3d4fca8dd..69ecf7df14 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/VarcharJdbcType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/VarcharJdbcType.java @@ -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() ) { diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/internal/JdbcTypeDescriptorBaseline.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/internal/JdbcTypeBaseline.java similarity index 98% rename from hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/internal/JdbcTypeDescriptorBaseline.java rename to hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/internal/JdbcTypeBaseline.java index 2551b9d7ef..0273ac4ac2 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/internal/JdbcTypeDescriptorBaseline.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/internal/JdbcTypeBaseline.java @@ -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); diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/spi/JdbcTypeDescriptorRegistry.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/spi/JdbcTypeRegistry.java similarity index 90% rename from hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/spi/JdbcTypeDescriptorRegistry.java rename to hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/spi/JdbcTypeRegistry.java index e144ec4f36..72ef3c66d6 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/spi/JdbcTypeDescriptorRegistry.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/spi/JdbcTypeRegistry.java @@ -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 descriptorMap = new ConcurrentHashMap<>(); - public JdbcTypeDescriptorRegistry(TypeConfiguration typeConfiguration) { + public JdbcTypeRegistry(TypeConfiguration typeConfiguration) { // this.typeConfiguration = typeConfiguration; - JdbcTypeDescriptorBaseline.prime( this ); + JdbcTypeBaseline.prime( this ); } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/hibernate-core/src/main/java/org/hibernate/type/spi/TypeConfiguration.java b/hibernate-core/src/main/java/org/hibernate/type/spi/TypeConfiguration.java index 104d6b81d7..0ab23feeb7 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/spi/TypeConfiguration.java +++ b/hibernate-core/src/main/java/org/hibernate/type/spi/TypeConfiguration.java @@ -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> 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 javaTypeDescriptor = javaTypeDescriptorRegistry.resolveDescriptor( javaType ); + final JavaType javaTypeDescriptor = javaTypeRegistry.resolveDescriptor( javaType ); return creator.apply( javaTypeDescriptor ); } ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/basics/sql/JdbcTypeTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/basics/sql/JdbcTypeTests.java index 99390d5293..fd42af904d 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/basics/sql/JdbcTypeTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/basics/sql/JdbcTypeTests.java @@ -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() ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/basics/sql/ListIndexJdbcTypeTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/basics/sql/ListIndexJdbcTypeTests.java index 881837ce96..eb87fcb21f 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/basics/sql/ListIndexJdbcTypeTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/basics/sql/ListIndexJdbcTypeTests.java @@ -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 ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/basics/sql/MapKeyJdbcTypeTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/basics/sql/MapKeyJdbcTypeTests.java index d77b25c60f..273a5c1cae 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/basics/sql/MapKeyJdbcTypeTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/basics/sql/MapKeyJdbcTypeTests.java @@ -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() ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/SmokeTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/SmokeTests.java index 8fcb20c03d..c885f7d780 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/SmokeTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/SmokeTests.java @@ -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(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/type/java/CoercionTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/type/java/CoercionTests.java index 30c2c5030a..cb71ecab73 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/type/java/CoercionTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/type/java/CoercionTests.java @@ -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 integerType = jtdRegistry.resolveDescriptor( Integer.class ); final JavaType longType = jtdRegistry.resolveDescriptor( Long.class ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/type/java/JavaTypeDescriptorRegistryTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/type/java/JavaTypeRegistryTest.java similarity index 89% rename from hibernate-core/src/test/java/org/hibernate/orm/test/mapping/type/java/JavaTypeDescriptorRegistryTest.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/mapping/type/java/JavaTypeRegistryTest.java index bb69bd3f2f..e24534d1db 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/type/java/JavaTypeDescriptorRegistryTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/type/java/JavaTypeRegistryTest.java @@ -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 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() ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/nationalized/SimpleNationalizedTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/nationalized/SimpleNationalizedTest.java index a3e68597b8..5885f4a1c3 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/nationalized/SimpleNationalizedTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/nationalized/SimpleNationalizedTest.java @@ -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() ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/nationalized/UseNationalizedCharDataSettingTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/nationalized/UseNationalizedCharDataSettingTest.java index 845a9fd679..1aae620da3 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/nationalized/UseNationalizedCharDataSettingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/nationalized/UseNationalizedCharDataSettingTest.java @@ -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() ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/sql/ast/SmokeTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/sql/ast/SmokeTests.java index cab8e7acd9..f7e5cdac92 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/sql/ast/SmokeTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/sql/ast/SmokeTests.java @@ -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 query = session.createQuery( "select e.gender from SimpleEntity e", Gender.class ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/type/OracleLongLobTypeTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/type/OracleLongLobTypeTest.java index 0528de9e39..8e998e1a1a 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/type/OracleLongLobTypeTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/type/OracleLongLobTypeTest.java @@ -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; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/typeoverride/TypeOverrideTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/typeoverride/TypeOverrideTest.java index 5db39b7227..dfbfeea5b3 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/typeoverride/TypeOverrideTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/typeoverride/TypeOverrideTest.java @@ -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 ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/test/type/LongListTypeContributorTest.java b/hibernate-core/src/test/java/org/hibernate/test/type/LongListTypeContributorTest.java index 9df9f5c6ee..865ee94209 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/type/LongListTypeContributorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/type/LongListTypeContributorTest.java @@ -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 ); }