diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingContext.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingContext.java index f199f525c5..d9897d339d 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingContext.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingContext.java @@ -6,6 +6,7 @@ */ package org.hibernate.boot.spi; +import org.hibernate.Incubating; import org.hibernate.boot.model.TypeDefinitionRegistry; import org.hibernate.boot.model.naming.ObjectNameNormalizer; import org.hibernate.internal.util.config.ConfigurationHelper; @@ -51,18 +52,22 @@ public interface MetadataBuildingContext { */ ObjectNameNormalizer getObjectNameNormalizer(); + @Incubating default int getPreferredSqlTypeCodeForBoolean() { return ConfigurationHelper.getPreferredSqlTypeCodeForBoolean( getBootstrapContext().getServiceRegistry() ); } + @Incubating default int getPreferredSqlTypeCodeForDuration() { return ConfigurationHelper.getPreferredSqlTypeCodeForDuration( getBootstrapContext().getServiceRegistry() ); } + @Incubating default int getPreferredSqlTypeCodeForUuid() { return ConfigurationHelper.getPreferredSqlTypeCodeForUuid( getBootstrapContext().getServiceRegistry() ); } + @Incubating default int getPreferredSqlTypeCodeForInstant() { return ConfigurationHelper.getPreferredSqlTypeCodeForInstant( getBootstrapContext().getServiceRegistry() ); } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/SessionFactoryOptions.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/SessionFactoryOptions.java index 8e15b41983..8fc46367dd 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/spi/SessionFactoryOptions.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/SessionFactoryOptions.java @@ -11,6 +11,7 @@ import java.util.function.Supplier; import org.hibernate.CustomEntityDirtinessStrategy; import org.hibernate.EntityNameResolver; +import org.hibernate.Incubating; import org.hibernate.Interceptor; import org.hibernate.SessionFactoryObserver; import org.hibernate.TimeZoneStorageStrategy; @@ -298,12 +299,16 @@ public interface SessionFactoryOptions extends QueryEngineOptions { return false; } + @Incubating int getPreferredSqlTypeCodeForBoolean(); + @Incubating int getPreferredSqlTypeCodeForDuration(); + @Incubating int getPreferredSqlTypeCodeForUuid(); + @Incubating int getPreferredSqlTypeCodeForInstant(); TimeZoneStorageStrategy getDefaultTimeZoneStorageStrategy(); diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java index 1176dd812b..9fd038aa95 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java @@ -2503,11 +2503,12 @@ public interface AvailableSettings { * Can be overridden locally using {@link org.hibernate.annotations.JdbcType}, * {@link org.hibernate.annotations.JdbcTypeCode} and friends * - * Can also specify the name of the constant in {@link org.hibernate.type.SqlTypes} instead. E.g. + * Can also specify the name of the {@link org.hibernate.type.SqlTypes} constant field. E.g. * {@code hibernate.type.preferred_boolean_jdbc_type=BIT} * * @since 6.0 */ + @Incubating String PREFERRED_BOOLEAN_JDBC_TYPE = "hibernate.type.preferred_boolean_jdbc_type"; /** @@ -2516,23 +2517,27 @@ public interface AvailableSettings { * Can be overridden locally using {@link org.hibernate.annotations.JdbcType}, * {@link org.hibernate.annotations.JdbcTypeCode} and friends * - * Can also specify the name of the constant in {@link org.hibernate.type.SqlTypes} instead. E.g. + * Can also specify the name of the {@link org.hibernate.type.SqlTypes} constant field. E.g. * {@code hibernate.type.preferred_uuid_jdbc_type=CHAR} + * + * @since 6.0 */ + @Incubating String PREFERRED_UUID_JDBC_TYPE = "hibernate.type.preferred_uuid_jdbc_type"; /** - * Specifies the preferred JDBC type for storing duration values. When no - * type is explicitly specified, {@link org.hibernate.type.SqlTypes#INTERVAL_SECOND} is used. + * The preferred JDBC type to use for storing duration values. Falls back to + * {@link org.hibernate.type.SqlTypes#INTERVAL_SECOND}. * * Can be overridden locally using {@link org.hibernate.annotations.JdbcType}, * {@link org.hibernate.annotations.JdbcTypeCode} and friends * - * Can also specify the name of the constant in {@link org.hibernate.type.SqlTypes} instead. E.g. + *Can also specify the name of the {@link org.hibernate.type.SqlTypes} constant field. E.g. * {@code hibernate.type.preferred_duration_jdbc_type=NUMERIC} * * @since 6.0 */ + @Incubating String PREFERRED_DURATION_JDBC_TYPE = "hibernate.type.preferred_duration_jdbc_type"; /** @@ -2542,15 +2547,16 @@ public interface AvailableSettings { * Can be overridden locally using {@link org.hibernate.annotations.JdbcType}, * {@link org.hibernate.annotations.JdbcTypeCode} and friends * - * Can also specify the name of the constant in {@link org.hibernate.type.SqlTypes} instead. E.g. + * Can also specify the name of the {@link org.hibernate.type.SqlTypes} constant field. E.g. * {@code hibernate.type.preferred_instant_jdbc_type=TIMESTAMP} * * @since 6.0 */ + @Incubating String PREFERRED_INSTANT_JDBC_TYPE = "hibernate.type.preferred_instant_jdbc_type"; /** - * Specifies a {@link org.hibernate.type.FormatMapper} used for for JSON serialization + * Specifies a {@link org.hibernate.type.FormatMapper} used for JSON serialization * and deserialization, either: *