mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-10 05:04:52 +00:00
Make the JDBC type to use for array/collection types configurable
This commit is contained in:
parent
b273c17592
commit
17fec64fd7
@ -257,6 +257,23 @@ public interface MappingSettings {
|
|||||||
@Incubating
|
@Incubating
|
||||||
String PREFER_NATIVE_ENUM_TYPES = "hibernate.type.prefer_native_enum_types";
|
String PREFER_NATIVE_ENUM_TYPES = "hibernate.type.prefer_native_enum_types";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the preferred JDBC type for storing plural i.e. array/collection values.
|
||||||
|
* <p>
|
||||||
|
* Can be overridden locally using {@link org.hibernate.annotations.JdbcType},
|
||||||
|
* {@link org.hibernate.annotations.JdbcTypeCode}, and friends.
|
||||||
|
* <p>
|
||||||
|
* Can also specify the name of the {@link org.hibernate.type.SqlTypes} constant
|
||||||
|
* field, for example, {@code hibernate.type.preferred_array_jdbc_type=ARRAY}
|
||||||
|
* or {@code hibernate.type.preferred_array_jdbc_type=TABLE}.
|
||||||
|
*
|
||||||
|
* @settingDefault {@link Dialect#getPreferredSqlTypeCodeForArray()}.
|
||||||
|
*
|
||||||
|
* @since 6.6
|
||||||
|
*/
|
||||||
|
@Incubating
|
||||||
|
String PREFERRED_ARRAY_JDBC_TYPE = "hibernate.type.preferred_array_jdbc_type";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies a {@link org.hibernate.type.format.FormatMapper} used for JSON
|
* Specifies a {@link org.hibernate.type.format.FormatMapper} used for JSON
|
||||||
* serialization and deserialization, either:
|
* serialization and deserialization, either:
|
||||||
|
@ -555,6 +555,14 @@ public static synchronized int getPreferredSqlTypeCodeForInstant(StandardService
|
|||||||
|
|
||||||
@Incubating
|
@Incubating
|
||||||
public static synchronized int getPreferredSqlTypeCodeForArray(StandardServiceRegistry serviceRegistry) {
|
public static synchronized int getPreferredSqlTypeCodeForArray(StandardServiceRegistry serviceRegistry) {
|
||||||
|
final Integer explicitSetting = serviceRegistry.requireService( ConfigurationService.class ).getSetting(
|
||||||
|
AvailableSettings.PREFERRED_ARRAY_JDBC_TYPE,
|
||||||
|
TypeCodeConverter.INSTANCE
|
||||||
|
);
|
||||||
|
if ( explicitSetting != null ) {
|
||||||
|
INCUBATION_LOGGER.incubatingSetting( AvailableSettings.PREFERRED_ARRAY_JDBC_TYPE );
|
||||||
|
return explicitSetting;
|
||||||
|
}
|
||||||
// default to the Dialect answer
|
// default to the Dialect answer
|
||||||
return serviceRegistry.requireService( JdbcServices.class )
|
return serviceRegistry.requireService( JdbcServices.class )
|
||||||
.getJdbcEnvironment()
|
.getJdbcEnvironment()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user