Top Fields
org.hibernate.cfg

public Interface MappingSettings

Known Direct Subinterfaces
org.hibernate.cfg.AvailableSettings
Imports
org.hibernate.Incubating, .Remove, .SessionFactory, org.hibernate.annotations.ListIndexBase, .Nationalized, org.hibernate.boot.jaxb.hbm.transform.UnsupportedFeatureHandling, org.hibernate.boot.registry.selector.spi.StrategySelector, org.hibernate.dialect.Dialect, org.hibernate.id.enhanced.ImplicitDatabaseObjectNamingStrategy, .StandardOptimizerDescriptor, org.hibernate.metamodel.CollectionClassification, org.hibernate.type.WrapperArrayHandling, org.hibernate.type.format.FormatMapper, jakarta.persistence.Column, .DiscriminatorColumn, .JoinColumn, .OrderColumn

Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
public static final String
ARTIFACT_PROCESSING_ORDER

Specifies the order in which metadata sources should be processed, is a delimited list of values defined by MetadataSourceType.

public static final String
public static final String
CREATE_EMPTY_COMPOSITES_ENABLED

Enable instantiation of composite/embedded objects when all attribute values are null.

public static final String
DEFAULT_CATALOG

A default database catalog name to use for unqualified database object (table, sequence, ...) names

public static final String
DEFAULT_LIST_SEMANTICS

Specifies the CollectionClassification to use for a plural attribute typed as java.util.List with no explicit list index details (OrderColumn, ListIndexBase, etc.).

public static final String
DEFAULT_SCHEMA

A default database schema (owner) name to use for unqualified database object (table, sequence, ...) names

public static final String
public static final String
GLOBALLY_QUOTED_IDENTIFIERS

When enabled, all database identifiers are quoted.

public 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.

public static final String
ID_DB_STRUCTURE_NAMING_STRATEGY

An implicit naming strategy for database structures (tables, sequences) related to identifier generators.

public static final String
IGNORE_EXPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASS

Controls whether Hibernate should ignore explicit discriminator metadata with joined inheritance.

public static final String
IMPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASS

Controls whether Hibernate should infer a discriminator for entity hierarchies defined with joined inheritance.

public static final String
public 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.
public static final String
JSON_FORMAT_MAPPER

Specifies a org.hibernate.type.format.FormatMapper used for JSON serialization and deserialization, either:

  • an instance of FormatMapper,
  • a Class representing a class that implements FormatMapper,
  • the name of a class that implements FormatMapper, or
  • one of the shorthand constants jackson or jsonb.
public static final String
KEYWORD_AUTO_QUOTING_ENABLED

Specifies whether to automatically quote any names that are deemed keywords on the underlying database.

public static final String
public static final String
PREFERRED_BOOLEAN_JDBC_TYPE

Specifies the preferred JDBC type for storing boolean values.

public static final String
PREFERRED_DURATION_JDBC_TYPE

The preferred JDBC type to use for storing java.time.Duration values.

public static final String
PREFERRED_INSTANT_JDBC_TYPE

Specifies the preferred JDBC type for storing java.time.Instant values.

public 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?

public static final String
PREFERRED_UUID_JDBC_TYPE

The preferred JDBC type to use for storing java.util.UUID values.

public static final String
SEQUENCE_INCREMENT_SIZE_MISMATCH_STRATEGY

This setting defines the org.hibernate.id.SequenceMismatchStrategy used when Hibernate detects a mismatch between a sequence configuration in an entity mapping and its database sequence object counterpart.

public 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.
public 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.

public static final String
TIMEZONE_DEFAULT_STORAGE

Specifies the default strategy for storage of the timezone information for the zoned datetime types java.time.OffsetDateTime and java.time.ZonedDateTime.

public static final String
TRANSFORM_HBM_XML

Enables processing hbm.xml mappings by transforming them to mapping.xml and using that processor.

public static final String
TRANSFORM_HBM_XML_FEATURE_HANDLING

How features in a hbm.xml file which are not supported for transformation should be handled.

public static final @Remove String
USE_ENTITY_WHERE_CLAUSE_FOR_COLLECTIONS

The @Where annotation specifies a restriction on the table rows which are visible as entity class instances or collection elements.

public static final String
USE_NATIONALIZED_CHARACTER_DATA

By default, Hibernate maps character data represented by Strings and java.sql.Clobs to the JDBC types java.sql.Types#VARCHAR and java.sql.Types#CLOB.

public static final String
VALIDATE_XML

Whether XML should be validated against their schema as Hibernate reads them.

public static final String
WRAPPER_ARRAY_HANDLING

Configurable control over how to handle Byte[] and Character[] types encountered in the application domain model.

public static final String
XML_FORMAT_MAPPER

Specifies a org.hibernate.type.format.FormatMapper used for XML serialization and deserialization, either:

  • an instance of FormatMapper,
  • a Class representing a class that implements FormatMapper,
  • the name of a class that implements FormatMapper, or
  • one of the shorthand constants jackson or jaxb.
public static final String
XML_MAPPING_ENABLED

Whether XML mappings should be processed.

Field Detail

ARTIFACT_PROCESSING_ORDERback to summary
public static final String ARTIFACT_PROCESSING_ORDER

Deprecated

for removal since 6.

hbm.xml mappings are no longer supported, making this attribute irrelevant

Specifies the order in which metadata sources should be processed, is a delimited list of values defined by MetadataSourceType.

Annotations
@SuppressWarnings:DeprecatedIsStillUsed
@Deprecated
since:6
forRemoval:true
See Also
MetadataSourceType, org.hibernate.boot.MetadataBuilder#applySourceProcessOrdering(MetadataSourceType...)
COLUMN_ORDERING_STRATEGYback to summary
public static final String COLUMN_ORDERING_STRATEGY

Used to specify the org.hibernate.boot.model.relational.ColumnOrderingStrategy class to use. The following shortcut names are defined for this setting:

Since
6.2
See Also
org.hibernate.boot.MetadataBuilder#applyColumnOrderingStrategy
CREATE_EMPTY_COMPOSITES_ENABLEDback to summary
public static final String CREATE_EMPTY_COMPOSITES_ENABLED

Deprecated

since 6.

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 are null. The default (and historical) behavior is that a null reference will be used to represent the composite value when all of its attributes are null.

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.

Annotations
@Incubating
@Deprecated
since:6
Since
5.1
DEFAULT_CATALOGback to summary
public static final String DEFAULT_CATALOG

A default database catalog name to use for unqualified database object (table, sequence, ...) names

See Also
org.hibernate.boot.MetadataBuilder#applyImplicitCatalogName
DEFAULT_LIST_SEMANTICSback to summary
public static final String DEFAULT_LIST_SEMANTICS

Specifies the CollectionClassification to use for a plural attribute typed as java.util.List with no explicit list index details (OrderColumn, ListIndexBase, etc.).

Accepts any of:

Since
6.0
See Also
org.hibernate.annotations.Bag
DEFAULT_SCHEMAback to summary
public static final String DEFAULT_SCHEMA

A default database schema (owner) name to use for unqualified database object (table, sequence, ...) names

See Also
org.hibernate.boot.MetadataBuilder#applyImplicitSchemaName
FORCE_DISCRIMINATOR_IN_SELECTS_BY_DEFAULTback to summary
public static final String FORCE_DISCRIMINATOR_IN_SELECTS_BY_DEFAULT
See Also
org.hibernate.boot.MetadataBuilder#enableImplicitForcingOfDiscriminatorsInSelect
GLOBALLY_QUOTED_IDENTIFIERSback to summary
public static final String GLOBALLY_QUOTED_IDENTIFIERS

When enabled, all database identifiers are quoted.

Corollary to the JPA <delimited-identifiers/> element within the orm.xml <persistence-unit-defaults/> element, but offered as a global flag.

GLOBALLY_QUOTED_IDENTIFIERS_SKIP_COLUMN_DEFINITIONSback to summary
public 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").

ID_DB_STRUCTURE_NAMING_STRATEGYback to summary
public static final String ID_DB_STRUCTURE_NAMING_STRATEGY

An implicit naming strategy for database structures (tables, sequences) related to identifier generators.

Resolution uses the org.hibernate.boot.registry.selector.spi.StrategySelector service and accepts any of the forms discussed on StrategySelector#resolveDefaultableStrategy(Class, Object, java.util.concurrent.Callable).

The recognized short names being:

  • single
  • legacy
  • standard
Annotations
@Incubating
Since
6
See Also
ImplicitDatabaseObjectNamingStrategy
IGNORE_EXPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASSback to summary
public 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.

Implementation Note

See Hibernate Jira issue HHH-6911 for additional background info.

See Also
org.hibernate.boot.MetadataBuilder#enableExplicitDiscriminatorsForJoinedSubclassSupport, IMPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASS
IMPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASSback to summary
public 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.

Implementation Note

See Hibernate Jira issue HHH-6911 for additional background info.

See Also
org.hibernate.boot.MetadataBuilder#enableImplicitDiscriminatorsForJoinedSubclassSupport, IGNORE_EXPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASS
IMPLICIT_NAMING_STRATEGYback to summary
public static final String IMPLICIT_NAMING_STRATEGY

Used to specify the org.hibernate.boot.model.naming.ImplicitNamingStrategy class to use. The following shortcut names are defined for this setting:

Since
5.0
See Also
org.hibernate.boot.MetadataBuilder#applyImplicitNamingStrategy
JPA_METAMODEL_POPULATIONback to summary
public 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.
JSON_FORMAT_MAPPERback to summary
public static final String JSON_FORMAT_MAPPER

Specifies a org.hibernate.type.format.FormatMapper used for JSON serialization and deserialization, either:

  • an instance of FormatMapper,
  • a Class representing a class that implements FormatMapper,
  • the name of a class that implements FormatMapper, or
  • one of the shorthand constants jackson or jsonb.

By default, the first of the possible providers that is available at runtime is used, according to the listing order.

Annotations
@Incubating
Since
6.0
See Also
org.hibernate.boot.SessionFactoryBuilder#applyJsonFormatMapper(FormatMapper)
KEYWORD_AUTO_QUOTING_ENABLEDback to summary
public 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
PHYSICAL_NAMING_STRATEGYback to summary
public static final String PHYSICAL_NAMING_STRATEGY

Specifies the org.hibernate.boot.model.naming.PhysicalNamingStrategy to use.

Since
5.0
See Also
org.hibernate.boot.MetadataBuilder#applyPhysicalNamingStrategy
PREFERRED_BOOLEAN_JDBC_TYPEback to summary
public static final String PREFERRED_BOOLEAN_JDBC_TYPE

Specifies the preferred JDBC type for storing boolean values.

Can be overridden locally using org.hibernate.annotations.JdbcType, org.hibernate.annotations.JdbcTypeCode, and friends.

Can also specify the name of the org.hibernate.type.SqlTypes constant field, for example, hibernate.type.preferred_boolean_jdbc_type=BIT.

Annotations
@Incubating
Since
6.0
PREFERRED_DURATION_JDBC_TYPEback to summary
public static final String PREFERRED_DURATION_JDBC_TYPE

The preferred JDBC type to use for storing java.time.Duration values.

Can be overridden locally using org.hibernate.annotations.JdbcType, org.hibernate.annotations.JdbcTypeCode, and friends.

Can also specify the name of the org.hibernate.type.SqlTypes constant field, for example, hibernate.type.preferred_duration_jdbc_type=INTERVAL_SECOND.

Annotations
@Incubating
Since
6.0
PREFERRED_INSTANT_JDBC_TYPEback to summary
public static final String PREFERRED_INSTANT_JDBC_TYPE

Specifies the preferred JDBC type for storing java.time.Instant values.

Can be overridden locally using org.hibernate.annotations.JdbcType, org.hibernate.annotations.JdbcTypeCode, and friends.

Can also specify the name of the org.hibernate.type.SqlTypes constant field, for example, hibernate.type.preferred_instant_jdbc_type=TIMESTAMP.

Annotations
@Incubating
Since
6.0
PREFERRED_POOLED_OPTIMIZERback to summary
public 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 implements org.hibernate.id.enhanced.Optimizer.

PREFERRED_UUID_JDBC_TYPEback to summary
public static final String PREFERRED_UUID_JDBC_TYPE

The preferred JDBC type to use for storing java.util.UUID values.

Can be overridden locally using org.hibernate.annotations.JdbcType, org.hibernate.annotations.JdbcTypeCode, and friends.

Can also specify the name of the org.hibernate.type.SqlTypes constant field, for example, hibernate.type.preferred_uuid_jdbc_type=CHAR.

Annotations
@Incubating
Since
6.0
SEQUENCE_INCREMENT_SIZE_MISMATCH_STRATEGYback to summary
public static final String SEQUENCE_INCREMENT_SIZE_MISMATCH_STRATEGY

This setting defines the org.hibernate.id.SequenceMismatchStrategy used when Hibernate detects a mismatch between a sequence configuration in an entity mapping and its database sequence object counterpart.

Possible values are org.hibernate.id.SequenceMismatchStrategy#EXCEPTION, org.hibernate.id.SequenceMismatchStrategy#LOG, org.hibernate.id.SequenceMismatchStrategy#FIX and org.hibernate.id.SequenceMismatchStrategy#NONE.

Since
5.4
STATIC_METAMODEL_POPULATIONback to summary
public 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.
TABLE_GENERATOR_STORE_LAST_USEDback to summary
public 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
TIMEZONE_DEFAULT_STORAGEback to summary
public static final String TIMEZONE_DEFAULT_STORAGE

Specifies the default strategy for storage of the timezone information for the zoned datetime types java.time.OffsetDateTime and java.time.ZonedDateTime. The possible options for this setting are enumerated by org.hibernate.annotations.TimeZoneStorageType.

API Note

For backward compatibility with older versions of Hibernate, set this property to NORMALIZE.

Since
6.0
See Also
org.hibernate.annotations.TimeZoneStorageType, org.hibernate.annotations.TimeZoneStorage
TRANSFORM_HBM_XMLback to summary
public static final String TRANSFORM_HBM_XML

Enables processing hbm.xml mappings by transforming them to mapping.xml and using that processor.

Since
6.1
TRANSFORM_HBM_XML_FEATURE_HANDLINGback to summary
public static final String TRANSFORM_HBM_XML_FEATURE_HANDLING

How features in a hbm.xml file which are not supported for transformation should be handled. Valid values are defined by UnsupportedFeatureHandling

Since
6.1
USE_ENTITY_WHERE_CLAUSE_FOR_COLLECTIONSback to summary
public static final @Remove String USE_ENTITY_WHERE_CLAUSE_FOR_COLLECTIONS

Deprecated

for removal since 6.2.

Originally added as a backwards compatibility flag

The @Where annotation 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.

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.

Annotations
@Remove
@Deprecated
forRemoval:true
since:6.2
USE_NATIONALIZED_CHARACTER_DATAback to summary
public static final String USE_NATIONALIZED_CHARACTER_DATA

By default, Hibernate maps character data represented by Strings and java.sql.Clobs to the JDBC types java.sql.Types#VARCHAR and java.sql.Types#CLOB. This setting, when enabled, turns on the use of explicit nationalized character support for mappings involving character data, specifying that the JDBC types java.sql.Types#NVARCHAR and java.sql.Types#NCLOB should be used instead.

This setting is relevant for use with databases with explicit nationalization support, and it is not needed for databases whose native varchar and clob types support Unicode data. (If you're not sure how your database handles Unicode, check out the implementation of Dialect#getNationalizationSupport() for its SQL dialect.)

Enabling this setting has two effects:

  1. when interacting with JDBC, Hibernate uses operations like java.sql.PreparedStatement#setNString(int, String) java.sql.PreparedStatement#setNClob(int, java.sql.NClob) to pass character data, and
  2. when generating DDL, the schema export tool uses nchar, nvarchar, or nclob as the generated column type when no column type is explicitly specified using jakarta.persistence.Column#columnDefinition().

API Note

This is a global setting applying to all mappings associated with a given SessionFactory. The Nationalized annotation may be used to selectively enable nationalized character support for specific columns.

See Also
org.hibernate.boot.MetadataBuilder#enableGlobalNationalizedCharacterDataSupport(boolean), Dialect#getNationalizationSupport, Nationalized
VALIDATE_XMLback to summary
public static final String VALIDATE_XML

Whether XML should be validated against their schema as Hibernate reads them.

Since
6.1
WRAPPER_ARRAY_HANDLINGback to summary
public static final String WRAPPER_ARRAY_HANDLING

Configurable control over how to handle Byte[] and Character[] types encountered in the application domain model. Allowable semantics are defined by WrapperArrayHandling. Accepted values include:

  1. WrapperArrayHandling instance
  2. case-insensitive name of a WrapperArrayHandling instance (e.g. allow)
Annotations
@Incubating
Since
6.2
XML_FORMAT_MAPPERback to summary
public static final String XML_FORMAT_MAPPER

Specifies a org.hibernate.type.format.FormatMapper used for XML serialization and deserialization, either:

  • an instance of FormatMapper,
  • a Class representing a class that implements FormatMapper,
  • the name of a class that implements FormatMapper, or
  • one of the shorthand constants jackson or jaxb.

By default, the first of the possible providers that is available at runtime is used, according to the listing order.

Annotations
@Incubating
Since
6.0.1
See Also
org.hibernate.boot.SessionFactoryBuilder#applyXmlFormatMapper(FormatMapper)
XML_MAPPING_ENABLEDback to summary
public static final String XML_MAPPING_ENABLED

Whether XML mappings should be processed.

API Note

This is a performance optimization appropriate when mapping details are defined exclusively using annotations.

Since
5.4.1