Interface MappingSettings
-
- All Known Subinterfaces:
AvailableSettings
- All Known Implementing Classes:
Environment
public interface MappingSettings
-
-
Field Summary
Fields Modifier and Type Field Description static StringARTIFACT_PROCESSING_ORDERDeprecated, for removal: This API element is subject to removal in a future version.hbm.xmlmappings are no longer supported, making this attribute irrelevantstatic StringCOLUMN_ORDERING_STRATEGYUsed to specify theColumnOrderingStrategyclass to use.static StringCREATE_EMPTY_COMPOSITES_ENABLEDDeprecated.It makes no sense at all to enable this at the global level for a persistence unit.static StringDEFAULT_CATALOGA default database catalog name to use for unqualified database object (table, sequence, ...) namesstatic StringDEFAULT_LIST_SEMANTICSSpecifies theCollectionClassificationto use for a plural attribute typed asListwith no explicit list index details (OrderColumn,ListIndexBase, etc.).static StringDEFAULT_SCHEMAA default database schema (owner) name to use for unqualified database object (table, sequence, ...) namesstatic StringFORCE_DISCRIMINATOR_IN_SELECTS_BY_DEFAULTstatic StringGLOBALLY_QUOTED_IDENTIFIERSWhen enabled, all database identifiers are quoted.static StringGLOBALLY_QUOTED_IDENTIFIERS_SKIP_COLUMN_DEFINITIONSControls whether column-definitions (Column.columnDefinition(),JoinColumn.columnDefinition(), etc.) should be auto-quoted as part of global quoting.static StringID_DB_STRUCTURE_NAMING_STRATEGYAn implicit naming strategy for database structures (tables, sequences) related to identifier generators.static StringIGNORE_EXPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASSControls whether Hibernate should ignore explicit discriminator metadata with joined inheritance.static StringIMPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASSControls whether Hibernate should infer a discriminator for entity hierarchies defined with joined inheritance.static StringIMPLICIT_NAMING_STRATEGYUsed to specify theImplicitNamingStrategyclass to use.static StringJPA_METAMODEL_POPULATIONSetting that indicates whether to build the JPA types, either: enabled - Do the build disabled - Do not do the build ignoreUnsupported - Do the build, but ignore any non-JPA features that would otherwise result in a failure.static StringJSON_FORMAT_MAPPERSpecifies aFormatMapperused for JSON serialization and deserialization, either: an instance ofFormatMapper, aClassrepresenting a class that implementsFormatMapper, the name of a class that implementsFormatMapper, or one of the shorthand constantsjacksonorjsonb.static StringKEYWORD_AUTO_QUOTING_ENABLEDSpecifies whether to automatically quote any names that are deemed keywords on the underlying database.static StringPHYSICAL_NAMING_STRATEGYSpecifies thePhysicalNamingStrategyto use.static StringPREFERRED_BOOLEAN_JDBC_TYPESpecifies the preferred JDBC type for storing boolean values.static StringPREFERRED_DURATION_JDBC_TYPEThe preferred JDBC type to use for storingDurationvalues.static StringPREFERRED_INSTANT_JDBC_TYPESpecifies the preferred JDBC type for storingInstantvalues.static StringPREFERRED_POOLED_OPTIMIZERWhen a generator specifies an increment-size and an optimizer was not explicitly specified, which of the "pooled" optimizers should be preferred? Can specify an optimizer short name or the name of a class which implementsOptimizer.static StringPREFERRED_UUID_JDBC_TYPEThe preferred JDBC type to use for storingUUIDvalues.static StringSEQUENCE_INCREMENT_SIZE_MISMATCH_STRATEGYThis setting defines theSequenceMismatchStrategyused when Hibernate detects a mismatch between a sequence configuration in an entity mapping and its database sequence object counterpart.static StringSTATIC_METAMODEL_POPULATIONSetting that controls whether we seek out JPA "static metamodel" classes and populate them, either: enabled - Do the population disabled - Do not do the population skipUnsupported - Do the population, but ignore any non-JPA features that would otherwise result in the population failing.static StringTABLE_GENERATOR_STORE_LAST_USEDDetermines if the identifier value stored in the database table backing a table generator is the last value returned by the identifier generator, or the next value to be returned.static StringTIMEZONE_DEFAULT_STORAGESpecifies the default strategy for storage of the timezone information for the zoned datetime typesOffsetDateTimeandZonedDateTime.static StringTRANSFORM_HBM_XMLEnables processinghbm.xmlmappings by transforming them tomapping.xmland using that processor.static StringTRANSFORM_HBM_XML_FEATURE_HANDLINGHow features in ahbm.xmlfile which are not supported for transformation should be handled.static @Remove StringUSE_ENTITY_WHERE_CLAUSE_FOR_COLLECTIONSDeprecated, for removal: This API element is subject to removal in a future version.Originally added as a backwards compatibility flagstatic StringUSE_NATIONALIZED_CHARACTER_DATABy default, Hibernate maps character data represented byStrings andClobs to the JDBC typesTypes.VARCHARandTypes.CLOB.static StringVALIDATE_XMLWhether XML should be validated against their schema as Hibernate reads them.static StringWRAPPER_ARRAY_HANDLINGConfigurable control over how to handleByte[]andCharacter[]types encountered in the application domain model.static StringXML_FORMAT_MAPPERSpecifies aFormatMapperused for XML serialization and deserialization, either: an instance ofFormatMapper, aClassrepresenting a class that implementsFormatMapper, the name of a class that implementsFormatMapper, or one of the shorthand constantsjacksonorjaxb.static StringXML_MAPPING_ENABLEDWhether XML mappings should be processed.
-
-
-
Field Detail
-
DEFAULT_CATALOG
static final String DEFAULT_CATALOG
A default database catalog name to use for unqualified database object (table, sequence, ...) names
-
DEFAULT_SCHEMA
static final String DEFAULT_SCHEMA
A default database schema (owner) name to use for unqualified database object (table, sequence, ...) names
-
JPA_METAMODEL_POPULATION
static final String JPA_METAMODEL_POPULATION
Setting that indicates whether to build the JPA types, either:- enabled - Do the build
- disabled - Do not do the build
- ignoreUnsupported - Do the build, but ignore any non-JPA features that would otherwise result in a failure.
- See Also:
- Constant Field Values
-
STATIC_METAMODEL_POPULATION
static final String STATIC_METAMODEL_POPULATION
Setting that controls whether we seek out JPA "static metamodel" classes and populate them, either:- enabled - Do the population
- disabled - Do not do the population
- skipUnsupported - Do the population, but ignore any non-JPA features that would otherwise result in the population failing.
- See Also:
- Constant Field Values
-
GLOBALLY_QUOTED_IDENTIFIERS
static final String GLOBALLY_QUOTED_IDENTIFIERS
When enabled, all database identifiers are quoted.Corollary to the JPA
<delimited-identifiers/>element within theorm.xml<persistence-unit-defaults/>element, but offered as a global flag.- See Also:
- Constant Field Values
- Default Value:
false
-
GLOBALLY_QUOTED_IDENTIFIERS_SKIP_COLUMN_DEFINITIONS
static final String GLOBALLY_QUOTED_IDENTIFIERS_SKIP_COLUMN_DEFINITIONS
Controls whether column-definitions (Column.columnDefinition(),JoinColumn.columnDefinition(), etc.) should be auto-quoted as part of global quoting.When global quoting is enabled, JPA states that column-definitions are subject to quoting. However, this can lead to problems with definitions such as
@Column(..., columnDefinition="INTEGER DEFAULT 20").- See Also:
- Constant Field Values
- Default Value:
falseto avoid the potential problems quoting non-trivial column-definitions.
-
KEYWORD_AUTO_QUOTING_ENABLED
static final String KEYWORD_AUTO_QUOTING_ENABLED
Specifies whether to automatically quote any names that are deemed keywords on the underlying database.- Since:
- 5.0
- See Also:
- Constant Field Values
- Default Value:
false- auto-quoting of SQL keywords is disabled by default.
-
PREFERRED_POOLED_OPTIMIZER
static final String PREFERRED_POOLED_OPTIMIZER
When a generator specifies an increment-size and an optimizer was not explicitly specified, which of the "pooled" optimizers should be preferred? Can specify an optimizer short name or the name of a class which implementsOptimizer.- See Also:
- Constant Field Values
- Default Value:
StandardOptimizerDescriptor.POOLED
-
TABLE_GENERATOR_STORE_LAST_USED
static final String TABLE_GENERATOR_STORE_LAST_USED
Determines if the identifier value stored in the database table backing a table generator is the last value returned by the identifier generator, or the next value to be returned.- Since:
- 5.3
- See Also:
- Constant Field Values
- Default Value:
- The value stored in the database table is the last generated value
-
SEQUENCE_INCREMENT_SIZE_MISMATCH_STRATEGY
static final String SEQUENCE_INCREMENT_SIZE_MISMATCH_STRATEGY
This setting defines theSequenceMismatchStrategyused when Hibernate detects a mismatch between a sequence configuration in an entity mapping and its database sequence object counterpart.Possible values are
SequenceMismatchStrategy.EXCEPTION,SequenceMismatchStrategy.LOG,SequenceMismatchStrategy.FIXandSequenceMismatchStrategy.NONE.- Since:
- 5.4
- See Also:
- Constant Field Values
- Default Value:
SequenceMismatchStrategy.EXCEPTION, meaning that an exception is thrown when such a conflict is detected.
-
PREFERRED_BOOLEAN_JDBC_TYPE
@Incubating static final String PREFERRED_BOOLEAN_JDBC_TYPE
Specifies the preferred JDBC type for storing boolean values.Can be overridden locally using
JdbcType,JdbcTypeCode, and friends.Can also specify the name of the
SqlTypesconstant field, for example,hibernate.type.preferred_boolean_jdbc_type=BIT.- Since:
- 6.0
- See Also:
- Constant Field Values
- Default Value:
- dialect-specific type code
-
PREFERRED_UUID_JDBC_TYPE
@Incubating static final String PREFERRED_UUID_JDBC_TYPE
The preferred JDBC type to use for storingUUIDvalues.Can be overridden locally using
JdbcType,JdbcTypeCode, and friends.Can also specify the name of the
SqlTypesconstant field, for example,hibernate.type.preferred_uuid_jdbc_type=CHAR.- Since:
- 6.0
- See Also:
- Constant Field Values
- Default Value:
SqlTypes.UUID.
-
PREFERRED_DURATION_JDBC_TYPE
@Incubating static final String PREFERRED_DURATION_JDBC_TYPE
The preferred JDBC type to use for storingDurationvalues.Can be overridden locally using
JdbcType,JdbcTypeCode, and friends.Can also specify the name of the
SqlTypesconstant field, for example,hibernate.type.preferred_duration_jdbc_type=INTERVAL_SECOND.- Since:
- 6.0
- See Also:
- Constant Field Values
- Default Value:
SqlTypes.NUMERIC
-
PREFERRED_INSTANT_JDBC_TYPE
@Incubating static final String PREFERRED_INSTANT_JDBC_TYPE
Specifies the preferred JDBC type for storingInstantvalues.Can be overridden locally using
JdbcType,JdbcTypeCode, and friends.Can also specify the name of the
SqlTypesconstant field, for example,hibernate.type.preferred_instant_jdbc_type=TIMESTAMP.- Since:
- 6.0
- See Also:
- Constant Field Values
- Default Value:
SqlTypes.TIMESTAMP_UTC.
-
JSON_FORMAT_MAPPER
@Incubating static final String JSON_FORMAT_MAPPER
Specifies aFormatMapperused for JSON serialization and deserialization, either:- an instance of
FormatMapper, - a
Classrepresenting a class that implementsFormatMapper, - the name of a class that implements
FormatMapper, or - one of the shorthand constants
jacksonorjsonb.
By default, the first of the possible providers that is available at runtime is used, according to the listing order.
- Since:
- 6.0
- See Also:
SessionFactoryBuilder.applyJsonFormatMapper(FormatMapper), Constant Field Values
- an instance of
-
XML_FORMAT_MAPPER
@Incubating static final String XML_FORMAT_MAPPER
Specifies aFormatMapperused for XML serialization and deserialization, either:- an instance of
FormatMapper, - a
Classrepresenting a class that implementsFormatMapper, - the name of a class that implements
FormatMapper, or - one of the shorthand constants
jacksonorjaxb.
By default, the first of the possible providers that is available at runtime is used, according to the listing order.
- Since:
- 6.0.1
- See Also:
SessionFactoryBuilder.applyXmlFormatMapper(FormatMapper), Constant Field Values
- an instance of
-
WRAPPER_ARRAY_HANDLING
@Incubating static final String WRAPPER_ARRAY_HANDLING
Configurable control over how to handleByte[]andCharacter[]types encountered in the application domain model. Allowable semantics are defined byWrapperArrayHandling. Accepted values include:WrapperArrayHandlinginstance- case-insensitive name of a
WrapperArrayHandlinginstance (e.g.allow)
- Since:
- 6.2
- See Also:
- Constant Field Values
-
TIMEZONE_DEFAULT_STORAGE
static final String TIMEZONE_DEFAULT_STORAGE
Specifies the default strategy for storage of the timezone information for the zoned datetime typesOffsetDateTimeandZonedDateTime. The possible options for this setting are enumerated byTimeZoneStorageType.- Since:
- 6.0
- See Also:
TimeZoneStorageType,TimeZoneStorage, Constant Field Values- API Note:
- For backward compatibility with older versions of Hibernate, set this property to
NORMALIZE. - Default Value:
DEFAULT, which guarantees that the instant represented by a zoned datetime type is preserved by a round trip to the database. It does not guarantee that the time zone or offset is preserved.
-
IMPLICIT_NAMING_STRATEGY
static final String IMPLICIT_NAMING_STRATEGY
Used to specify theImplicitNamingStrategyclass to use. The following shortcut names are defined for this setting:"default"and"jpa"are an abbreviations forImplicitNamingStrategyJpaCompliantImpl"legacy-jpa"is an abbreviation forImplicitNamingStrategyLegacyJpaImpl"legacy-hbm"is an abbreviation forImplicitNamingStrategyLegacyHbmImpl"component-path"is an abbreviation forImplicitNamingStrategyComponentPathImpl
- Since:
- 5.0
- See Also:
MetadataBuilder.applyImplicitNamingStrategy(org.hibernate.boot.model.naming.ImplicitNamingStrategy), Constant Field Values- Default Value:
"default"
-
PHYSICAL_NAMING_STRATEGY
static final String PHYSICAL_NAMING_STRATEGY
Specifies thePhysicalNamingStrategyto use.- Since:
- 5.0
- See Also:
MetadataBuilder.applyPhysicalNamingStrategy(org.hibernate.boot.model.naming.PhysicalNamingStrategy), Constant Field Values- Default Value:
PhysicalNamingStrategyStandardImpl, in which case physical names are taken to be identical to logical names.
-
ID_DB_STRUCTURE_NAMING_STRATEGY
@Incubating static final String ID_DB_STRUCTURE_NAMING_STRATEGY
An implicit naming strategy for database structures (tables, sequences) related to identifier generators.Resolution uses the
StrategySelectorservice and accepts any of the forms discussed onStrategySelector.resolveDefaultableStrategy(Class, Object, java.util.concurrent.Callable).The recognized short names being:
- Since:
- 6
- See Also:
ImplicitDatabaseObjectNamingStrategy, Constant Field Values- Default Value:
StandardNamingStrategy
-
COLUMN_ORDERING_STRATEGY
static final String COLUMN_ORDERING_STRATEGY
Used to specify theColumnOrderingStrategyclass to use. The following shortcut names are defined for this setting:"default"is an abbreviations forColumnOrderingStrategyStandard"legacy"is an abbreviation forColumnOrderingStrategyLegacy
- Since:
- 6.2
- See Also:
MetadataBuilder.applyColumnOrderingStrategy(org.hibernate.boot.model.relational.ColumnOrderingStrategy), Constant Field Values- Default Value:
"default"
-
ARTIFACT_PROCESSING_ORDER
@Deprecated(since="6", forRemoval=true) static final String ARTIFACT_PROCESSING_ORDER
Deprecated, for removal: This API element is subject to removal in a future version.hbm.xmlmappings are no longer supported, making this attribute irrelevantSpecifies the order in which metadata sources should be processed, is a delimited list of values defined byMetadataSourceType.- See Also:
MetadataSourceType,MetadataBuilder.applySourceProcessOrdering(MetadataSourceType...), Constant Field Values- Default Value:
"hbm,class", which indicates thathbm.xmlfiles should be processed first, followed by annotations andorm.xmlfiles.
-
XML_MAPPING_ENABLED
static final String XML_MAPPING_ENABLED
Whether XML mappings should be processed.- Since:
- 5.4.1
- See Also:
- Constant Field Values
- API Note:
- This is a performance optimization appropriate when mapping details are defined exclusively using annotations.
- Default Value:
true- XML mappings are processed
-
DEFAULT_LIST_SEMANTICS
static final String DEFAULT_LIST_SEMANTICS
Specifies theCollectionClassificationto use for a plural attribute typed asListwith no explicit list index details (OrderColumn,ListIndexBase, etc.).Accepts any of:
- an instance of
CollectionClassification - the (case insensitive) name of a
CollectionClassification(list e.g.) - a
Classrepresenting eitherListorCollection
- Since:
- 6.0
- See Also:
Bag, Constant Field Values- Default Value:
CollectionClassification.BAG
- an instance of
-
CREATE_EMPTY_COMPOSITES_ENABLED
@Incubating @Deprecated(since="6") static final String CREATE_EMPTY_COMPOSITES_ENABLED
Deprecated.It makes no sense at all to enable this at the global level for a persistence unit. If anything, it could be a setting specific to a given embeddable class. But, four years after the introduction of this feature, it's still marked experimental and has multiple known unresolved bugs. It's therefore time for those who advocated for this feature to accept defeat.Enable instantiation of composite/embedded objects when all attribute values arenull. The default (and historical) behavior is that anullreference will be used to represent the composite value when all of its attributes arenull.- Since:
- 5.1
- See Also:
- Constant Field Values
- API Note:
- This is an experimental feature that has known issues. It should not be used in production until it is stabilized. See Hibernate JIRA issue HHH-11936 for details.
-
USE_ENTITY_WHERE_CLAUSE_FOR_COLLECTIONS
@Remove @Deprecated(forRemoval=true, since="6.2") static final @Remove String USE_ENTITY_WHERE_CLAUSE_FOR_COLLECTIONS
Deprecated, for removal: This API element is subject to removal in a future version.Originally added as a backwards compatibility flagThe@Whereannotation specifies a restriction on the table rows which are visible as entity class instances or collection elements.This setting controls whether the restriction applied to an entity should be applied to association fetches (for one-to-one, many-to-one, one-to-many, and many-to-many associations) which target the entity.
- See Also:
- Constant Field Values
- API Note:
- The setting is very misnamed - it applies across all entity associations, not only to collections.
- Implementation Specification:
- Enabled (
true) by default, meaning the restriction is applied. When this setting is explicitly disabled (false), the restriction is not applied.
-
VALIDATE_XML
static final String VALIDATE_XML
Whether XML should be validated against their schema as Hibernate reads them.- Since:
- 6.1
- See Also:
- Constant Field Values
- Default Value:
true
-
TRANSFORM_HBM_XML
static final String TRANSFORM_HBM_XML
Enables processinghbm.xmlmappings by transforming them tomapping.xmland using that processor.- Since:
- 6.1
- See Also:
- Constant Field Values
- Default Value:
false(opt-in).
-
TRANSFORM_HBM_XML_FEATURE_HANDLING
static final String TRANSFORM_HBM_XML_FEATURE_HANDLING
How features in ahbm.xmlfile which are not supported for transformation should be handled. Valid values are defined byUnsupportedFeatureHandling- Since:
- 6.1
- See Also:
- Constant Field Values
- Default Value:
UnsupportedFeatureHandling.ERROR
-
FORCE_DISCRIMINATOR_IN_SELECTS_BY_DEFAULT
static final String FORCE_DISCRIMINATOR_IN_SELECTS_BY_DEFAULT
- See Also:
MetadataBuilder.enableImplicitForcingOfDiscriminatorsInSelect(boolean), Constant Field Values- Default Value:
false
-
IMPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASS
static final String IMPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASS
Controls whether Hibernate should infer a discriminator for entity hierarchies defined with joined inheritance.Hibernate does not need a discriminator with joined inheritance. Therefore, its legacy behavior is to not infer a discriminator. However, some JPA providers do require discriminators with joined inheritance, so in the interest of portability this option has been added to Hibernate. When enabled (
true), Hibernate will treat the absence of discriminator metadata as an indication to use the JPA defined defaults for discriminators.- See Also:
MetadataBuilder.enableImplicitDiscriminatorsForJoinedSubclassSupport(boolean),IGNORE_EXPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASS, Constant Field Values- Implementation Note:
- See Hibernate Jira issue HHH-6911 for additional background info.
- Default Value:
false
-
IGNORE_EXPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASS
static final String IGNORE_EXPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASS
Controls whether Hibernate should ignore explicit discriminator metadata with joined inheritance.Hibernate does not need a discriminator with joined inheritance. Historically it simply ignored discriminator metadata. When enabled (
true), any discriminator metadata (DiscriminatorColumn, e.g.) is ignored allowing for backwards compatibility.- See Also:
MetadataBuilder.enableExplicitDiscriminatorsForJoinedSubclassSupport(boolean),IMPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASS, Constant Field Values- Implementation Note:
- See Hibernate Jira issue HHH-6911 for additional background info.
- Default Value:
false
-
USE_NATIONALIZED_CHARACTER_DATA
static final String USE_NATIONALIZED_CHARACTER_DATA
By default, Hibernate maps character data represented byStrings andClobs to the JDBC typesTypes.VARCHARandTypes.CLOB. This setting, when enabled, turns on the use of explicit nationalized character support for mappings involving character data, specifying that the JDBC typesTypes.NVARCHARandTypes.NCLOBshould be used instead.This setting is relevant for use with databases with explicit nationalization support, and it is not needed for databases whose native
varcharandclobtypes support Unicode data. (If you're not sure how your database handles Unicode, check out the implementation ofDialect.getNationalizationSupport()for its SQL dialect.)Enabling this setting has two effects:
- when interacting with JDBC, Hibernate uses operations like
PreparedStatement.setNString(int, String)PreparedStatement.setNClob(int, java.sql.NClob)to pass character data, and - when generating DDL, the schema export tool uses
nchar,nvarchar, ornclobas the generated column type when no column type is explicitly specified usingColumn.columnDefinition().
- See Also:
MetadataBuilder.enableGlobalNationalizedCharacterDataSupport(boolean),Dialect.getNationalizationSupport(),Nationalized, Constant Field Values- API Note:
- This is a global setting applying to all mappings associated with a given
SessionFactory. TheNationalizedannotation may be used to selectively enable nationalized character support for specific columns. - Default Value:
false(disabled)
- when interacting with JDBC, Hibernate uses operations like
-
-