Top Fields
org.hibernate.cfg

public Interface JpaComplianceSettings

Known Direct Subinterfaces
org.hibernate.cfg.AvailableSettings

Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
public static final String
JPA_CACHING_COMPLIANCE

By default, Hibernate uses second-level cache invalidation for entities with secondary tables in order to avoid the possibility of inconsistent cached data in the case where different transactions simultaneously update different table rows corresponding to the same entity instance.

public static final String
public static final String
JPA_COMPLIANCE

Specifies a default value for all org.hibernate.jpa.spi.JpaCompliance flags.

public static final String
JPA_ID_GENERATOR_GLOBAL_SCOPE_COMPLIANCE

Determines whether the scope of any identifier generator name specified via jakarta.persistence.TableGenerator#name() or jakarta.persistence.SequenceGenerator#name() is considered global to the persistence unit, or local to the entity in which identifier generator is defined.

public static final String
JPA_LIST_COMPLIANCE

Controls whether Hibernate should treat what it would usually consider a "bag", that is, a list with no index column, whose element order is not persistent, as a true list with an index column and a persistent element order.

public static final String
JPA_LOAD_BY_ID_COMPLIANCE

Determines if an identifier value passed to jakarta.persistence.EntityManager#find or jakarta.persistence.EntityManager#getReference may be coerced to the identifier type declared by the entity.

public static final String
JPA_ORDER_BY_MAPPING_COMPLIANCE

JPA specifies that items occurring in jakarta.persistence.OrderBy lists must be references to entity attributes, whereas Hibernate, by default, allows more complex expressions.

public static final String
JPA_PROXY_COMPLIANCE

The JPA specification insists that an jakarta.persistence.EntityNotFoundException must be thrown whenever an uninitialized entity proxy with no corresponding row in the database is accessed.

public static final String
JPA_QUERY_COMPLIANCE

Controls whether Hibernate’s handling of jakarta.persistence.Query (JPQL, Criteria and native) should strictly follow the requirements defined in the Jakarta Persistence specification, both in terms of JPQL validation and behavior of jakarta.persistence.Query method implementations.

public static final String
JPA_TRANSACTION_COMPLIANCE

When enabled, specifies that the Hibernate org.hibernate.Transaction should behave according to the semantics defined by the JPA specification for an jakarta.persistence.EntityTransaction.

public static final String

Field Detail

JPA_CACHING_COMPLIANCEback to summary
public static final String JPA_CACHING_COMPLIANCE

By default, Hibernate uses second-level cache invalidation for entities with secondary tables in order to avoid the possibility of inconsistent cached data in the case where different transactions simultaneously update different table rows corresponding to the same entity instance.

The Jakarta Persistence TCK, requires that entities with secondary tables be immediately cached in the second-level cache rather than invalidated and re-cached on a subsequent read.

API Note

Hibernate's default behavior here is safer and more careful than the behavior mandated by the TCK but YOLO

Since
5.3
See Also
org.hibernate.jpa.spi.JpaCompliance#isJpaCacheComplianceEnabled(), org.hibernate.persister.entity.AbstractEntityPersister#isCacheInvalidationRequired()
JPA_CLOSED_COMPLIANCEback to summary
public static final String JPA_CLOSED_COMPLIANCE

JPA specifies that an IllegalStateException must be thrown by jakarta.persistence.EntityManager#close() and jakarta.persistence.EntityManagerFactory#close() if the object has already been closed. By default, Hibernate treats any additional call to close() as a noop.

API Note

When enabled, this setting forces Hibernate to throw an exception if close() is called on an instance that was already closed.

Since
5.3
See Also
org.hibernate.jpa.spi.JpaCompliance#isJpaClosedComplianceEnabled(), org.hibernate.boot.SessionFactoryBuilder#enableJpaClosedCompliance(boolean)
JPA_COMPLIANCEback to summary
public static final String JPA_COMPLIANCE

Specifies a default value for all org.hibernate.jpa.spi.JpaCompliance flags. Each individual flag may still be overridden by explicitly specifying its specific configuration property.

Since
6.0
See Also
JPA_TRANSACTION_COMPLIANCE, JPA_QUERY_COMPLIANCE, JPA_LIST_COMPLIANCE, JPA_ORDER_BY_MAPPING_COMPLIANCE, JPA_CLOSED_COMPLIANCE, JPA_PROXY_COMPLIANCE, JPA_CACHING_COMPLIANCE, JPA_ID_GENERATOR_GLOBAL_SCOPE_COMPLIANCE, JPA_LOAD_BY_ID_COMPLIANCE
JPA_ID_GENERATOR_GLOBAL_SCOPE_COMPLIANCEback to summary
public static final String JPA_ID_GENERATOR_GLOBAL_SCOPE_COMPLIANCE

Determines whether the scope of any identifier generator name specified via jakarta.persistence.TableGenerator#name() or jakarta.persistence.SequenceGenerator#name() is considered global to the persistence unit, or local to the entity in which identifier generator is defined.

API Note

If enabled, the name will be considered globally scoped, and so the existence of two different generators with the same name will be considered a collision, and will result in an exception during bootstrap.

Since
5.2.17
See Also
org.hibernate.jpa.spi.JpaCompliance#isGlobalGeneratorScopeEnabled()
JPA_LIST_COMPLIANCEback to summary
public static final String JPA_LIST_COMPLIANCE

Deprecated

since 6.0.

Use MappingSettings#DEFAULT_LIST_SEMANTICS instead. The specification actually leaves this behavior undefined, saying that portable applications should not rely on any specific behavior for a java.util.List with no @OrderColumn.

Controls whether Hibernate should treat what it would usually consider a "bag", that is, a list with no index column, whose element order is not persistent, as a true list with an index column and a persistent element order.

API Note

If enabled, Hibernate will recognize it as a list where the jakarta.persistence.OrderColumn annotation is simply missing (and its defaults will apply).

Annotations
@Deprecated
since:6.0
@SuppressWarnings:DeprecatedIsStillUsed
Since
5.3
See Also
org.hibernate.jpa.spi.JpaCompliance#isJpaListComplianceEnabled(), org.hibernate.boot.SessionFactoryBuilder#enableJpaListCompliance(boolean)
JPA_LOAD_BY_ID_COMPLIANCEback to summary
public static final String JPA_LOAD_BY_ID_COMPLIANCE

Determines if an identifier value passed to jakarta.persistence.EntityManager#find or jakarta.persistence.EntityManager#getReference may be coerced to the identifier type declared by the entity. For example, an Integer argument might be widened to Long.

API Note

When enabled, coercion is disallowed, as required by the JPA specification. Hibernate's default (here non-compliant) behavior is to allow the coercion.

Since
6.0
See Also
org.hibernate.jpa.spi.JpaCompliance#isLoadByIdComplianceEnabled()
JPA_ORDER_BY_MAPPING_COMPLIANCEback to summary
public static final String JPA_ORDER_BY_MAPPING_COMPLIANCE

JPA specifies that items occurring in jakarta.persistence.OrderBy lists must be references to entity attributes, whereas Hibernate, by default, allows more complex expressions.

API Note

If enabled, an exception is thrown for items which are not entity attribute references.

Since
6.0
See Also
org.hibernate.jpa.spi.JpaCompliance#isJpaOrderByMappingComplianceEnabled(), org.hibernate.boot.SessionFactoryBuilder#enableJpaOrderByMappingCompliance(boolean)
JPA_PROXY_COMPLIANCEback to summary
public static final String JPA_PROXY_COMPLIANCE

The JPA specification insists that an jakarta.persistence.EntityNotFoundException must be thrown whenever an uninitialized entity proxy with no corresponding row in the database is accessed. For most programs, this results in many completely unnecessary round trips to the database.

Traditionally, Hibernate does not initialize an entity proxy when its identifier attribute is accessed, since the identifier value is already known and held in the proxy instance. This behavior saves the round trip to the database.

API Note

When enabled, this setting forces Hibernate to initialize the entity proxy when its identifier is accessed. Clearly, this setting is not recommended.

Since
5.2.13
See Also
org.hibernate.jpa.spi.JpaCompliance#isJpaProxyComplianceEnabled()
JPA_QUERY_COMPLIANCEback to summary
public static final String JPA_QUERY_COMPLIANCE

Controls whether Hibernate’s handling of jakarta.persistence.Query (JPQL, Criteria and native) should strictly follow the requirements defined in the Jakarta Persistence specification, both in terms of JPQL validation and behavior of jakarta.persistence.Query method implementations.

API Note

When disabled, allows the many useful features of HQL

Since
5.3
See Also
org.hibernate.jpa.spi.JpaCompliance#isJpaQueryComplianceEnabled(), org.hibernate.boot.SessionFactoryBuilder#enableJpaQueryCompliance(boolean)
JPA_TRANSACTION_COMPLIANCEback to summary
public static final String JPA_TRANSACTION_COMPLIANCE

When enabled, specifies that the Hibernate org.hibernate.Transaction should behave according to the semantics defined by the JPA specification for an jakarta.persistence.EntityTransaction.

Since
5.3
See Also
org.hibernate.jpa.spi.JpaCompliance#isJpaTransactionComplianceEnabled(), org.hibernate.boot.SessionFactoryBuilder#enableJpaTransactionCompliance(boolean)
JPAQL_STRICT_COMPLIANCEback to summary
public static final String JPAQL_STRICT_COMPLIANCE

Deprecated

Prefer JPA_QUERY_COMPLIANCE

Annotations
@Deprecated