Package org.hibernate.cfg
Interface JpaComplianceSettings
-
public interface JpaComplianceSettings
-
-
Field Summary
Fields Modifier and Type Field Description static StringJPA_CACHING_COMPLIANCEBy 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.static StringJPA_CLOSED_COMPLIANCEJPA specifies that anIllegalStateExceptionmust be thrown byEntityManager.close()andEntityManagerFactory.close()if the object has already been closed.static StringJPA_COMPLIANCESpecifies a default value for allJpaComplianceflags.static StringJPA_ID_GENERATOR_GLOBAL_SCOPE_COMPLIANCEDetermines whether the scope of any identifier generator name specified viaTableGenerator.name()orSequenceGenerator.name()is considered global to the persistence unit, or local to the entity in which identifier generator is defined.static StringJPA_LIST_COMPLIANCEDeprecated.UseMappingSettings.DEFAULT_LIST_SEMANTICSinstead.static StringJPA_LOAD_BY_ID_COMPLIANCEDetermines if an identifier value passed toEntityManager.find(java.lang.Class<T>, java.lang.Object)orEntityManager.getReference(java.lang.Class<T>, java.lang.Object)may be coerced to the identifier type declared by the entity.static StringJPA_ORDER_BY_MAPPING_COMPLIANCEJPA specifies that items occurring inOrderBylists must be references to entity attributes, whereas Hibernate, by default, allows more complex expressions.static StringJPA_PROXY_COMPLIANCEThe JPA specification insists that anEntityNotFoundExceptionmust be thrown whenever an uninitialized entity proxy with no corresponding row in the database is accessed.static StringJPA_QUERY_COMPLIANCEstatic StringJPA_TRANSACTION_COMPLIANCEWhen enabled, specifies that the HibernateTransactionshould behave according to the semantics defined by the JPA specification for anEntityTransaction.static StringJPAQL_STRICT_COMPLIANCEDeprecated.PreferJPA_QUERY_COMPLIANCE
-
-
-
Field Detail
-
JPA_COMPLIANCE
static final String JPA_COMPLIANCE
Specifies a default value for allJpaComplianceflags. 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, Constant Field Values- Default Value:
truewith JPA bootstrapping;falseotherwise.
-
JPA_TRANSACTION_COMPLIANCE
static final String JPA_TRANSACTION_COMPLIANCE
When enabled, specifies that the HibernateTransactionshould behave according to the semantics defined by the JPA specification for anEntityTransaction.- Since:
- 5.3
- See Also:
JpaCompliance.isJpaTransactionComplianceEnabled(),SessionFactoryBuilder.enableJpaTransactionCompliance(boolean), Constant Field Values- Default Value:
JPA_COMPLIANCE
-
JPA_QUERY_COMPLIANCE
static final String JPA_QUERY_COMPLIANCE
Controls whether Hibernate’s handling ofQuery(JPQL, Criteria and native) should strictly follow the requirements defined in the Jakarta Persistence specification, both in terms of JPQL validation and behavior ofQuerymethod implementations.- Since:
- 5.3
- See Also:
JpaCompliance.isJpaQueryComplianceEnabled(),SessionFactoryBuilder.enableJpaQueryCompliance(boolean), Constant Field Values- API Note:
- When disabled, allows the many useful features of HQL
- Default Value:
JPA_COMPLIANCE
-
JPA_LIST_COMPLIANCE
@Deprecated(since="6.0") static final String JPA_LIST_COMPLIANCE
Deprecated.UseMappingSettings.DEFAULT_LIST_SEMANTICSinstead. The specification actually leaves this behavior undefined, saying that portable applications should not rely on any specific behavior for aListwith 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 truelistwith an index column and a persistent element order.- Since:
- 5.3
- See Also:
JpaCompliance.isJpaListComplianceEnabled(),SessionFactoryBuilder.enableJpaListCompliance(boolean), Constant Field Values- API Note:
- If enabled, Hibernate will recognize it as a list where the
OrderColumnannotation is simply missing (and its defaults will apply). - Default Value:
JPA_COMPLIANCE
-
JPA_ORDER_BY_MAPPING_COMPLIANCE
static final String JPA_ORDER_BY_MAPPING_COMPLIANCE
JPA specifies that items occurring inOrderBylists must be references to entity attributes, whereas Hibernate, by default, allows more complex expressions.- Since:
- 6.0
- See Also:
JpaCompliance.isJpaOrderByMappingComplianceEnabled(),SessionFactoryBuilder.enableJpaOrderByMappingCompliance(boolean), Constant Field Values- API Note:
- If enabled, an exception is thrown for items which are not entity attribute references.
- Default Value:
JPA_COMPLIANCE
-
JPA_CLOSED_COMPLIANCE
static final String JPA_CLOSED_COMPLIANCE
JPA specifies that anIllegalStateExceptionmust be thrown byEntityManager.close()andEntityManagerFactory.close()if the object has already been closed. By default, Hibernate treats any additional call toclose()as a noop.- Since:
- 5.3
- See Also:
JpaCompliance.isJpaClosedComplianceEnabled(),SessionFactoryBuilder.enableJpaClosedCompliance(boolean), Constant Field Values- API Note:
- When enabled, this setting forces Hibernate to throw an exception if
close()is called on an instance that was already closed. - Default Value:
JPA_COMPLIANCE
-
JPA_PROXY_COMPLIANCE
static final String JPA_PROXY_COMPLIANCE
The JPA specification insists that anEntityNotFoundExceptionmust 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.
- Since:
- 5.2.13
- See Also:
JpaCompliance.isJpaProxyComplianceEnabled(), Constant Field Values- API Note:
- When enabled, this setting forces Hibernate to initialize the entity proxy when its identifier is accessed. Clearly, this setting is not recommended.
- Default Value:
JPA_COMPLIANCE
-
JPA_CACHING_COMPLIANCE
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.
- Since:
- 5.3
- See Also:
JpaCompliance.isJpaCacheComplianceEnabled(),AbstractEntityPersister.isCacheInvalidationRequired(), Constant Field Values- API Note:
- Hibernate's default behavior here is safer and more careful than the behavior mandated by the TCK but YOLO
- Default Value:
JPA_COMPLIANCE
-
JPA_ID_GENERATOR_GLOBAL_SCOPE_COMPLIANCE
static final String JPA_ID_GENERATOR_GLOBAL_SCOPE_COMPLIANCE
Determines whether the scope of any identifier generator name specified viaTableGenerator.name()orSequenceGenerator.name()is considered global to the persistence unit, or local to the entity in which identifier generator is defined.- Since:
- 5.2.17
- See Also:
JpaCompliance.isGlobalGeneratorScopeEnabled(), Constant Field Values- 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.
- Default Value:
JPA_COMPLIANCE
-
JPA_LOAD_BY_ID_COMPLIANCE
static final String JPA_LOAD_BY_ID_COMPLIANCE
Determines if an identifier value passed toEntityManager.find(java.lang.Class<T>, java.lang.Object)orEntityManager.getReference(java.lang.Class<T>, java.lang.Object)may be coerced to the identifier type declared by the entity. For example, anIntegerargument might be widened toLong.- Since:
- 6.0
- See Also:
JpaCompliance.isLoadByIdComplianceEnabled(), Constant Field Values- 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.
- Default Value:
JPA_COMPLIANCE
-
JPAQL_STRICT_COMPLIANCE
@Deprecated static final String JPAQL_STRICT_COMPLIANCE
Deprecated.PreferJPA_QUERY_COMPLIANCE- See Also:
- Constant Field Values
-
-