Package org.hibernate.cfg
Interface JpaComplianceSettings
-
- All Known Subinterfaces:
AvailableSettings
- All Known Implementing Classes:
Environment
public interface JpaComplianceSettings
-
-
Field Summary
Fields Modifier and Type Field Description static 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.static String
JPA_CASCADE_COMPLIANCE
Controls whether Hibernate applies cascadeCascadeType.PERSIST
orCascadeType.SAVE_UPDATE
at flush time.static String
JPA_CLOSED_COMPLIANCE
JPA specifies that anIllegalStateException
must be thrown byEntityManager.close()
andEntityManagerFactory.close()
if the object has already been closed.static String
JPA_COMPLIANCE
Specifies a default value for allJpaCompliance
flags.static 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.static String
JPA_LIST_COMPLIANCE
Deprecated.UseMappingSettings.DEFAULT_LIST_SEMANTICS
instead.static 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.static String
JPA_ORDER_BY_MAPPING_COMPLIANCE
JPA specifies that items occurring inOrderBy
lists must be references to entity attributes, whereas Hibernate, by default, allows more complex expressions.static String
JPA_PROXY_COMPLIANCE
The JPA specification insists that anEntityNotFoundException
must be thrown whenever an uninitialized entity proxy with no corresponding row in the database is accessed.static String
JPA_QUERY_COMPLIANCE
static String
JPA_TRANSACTION_COMPLIANCE
When enabled, specifies that the HibernateTransaction
should behave according to the semantics defined by the JPA specification for anEntityTransaction
.static String
JPAQL_STRICT_COMPLIANCE
Deprecated.PreferJPA_QUERY_COMPLIANCE
-
-
-
Field Detail
-
JPA_COMPLIANCE
static final String JPA_COMPLIANCE
Specifies a default value for allJpaCompliance
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
, Constant Field Values- Default Value:
true
with JPA bootstrapping;false
otherwise.
-
JPA_TRANSACTION_COMPLIANCE
static final String JPA_TRANSACTION_COMPLIANCE
When enabled, specifies that the HibernateTransaction
should 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 ofQuery
method 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_CASCADE_COMPLIANCE
static final String JPA_CASCADE_COMPLIANCE
Controls whether Hibernate applies cascadeCascadeType.PERSIST
orCascadeType.SAVE_UPDATE
at flush time. If enabled, Hibernate will cascade the standard JPAPERSIST
operation. Otherwise, Hibernate will cascade the legacySAVE_UPDATE
operation.- Since:
- 6.6
- See Also:
- Constant Field Values
- Default Value:
JPA_COMPLIANCE
-
JPA_LIST_COMPLIANCE
@Deprecated(since="6.0") static final String JPA_LIST_COMPLIANCE
Deprecated.UseMappingSettings.DEFAULT_LIST_SEMANTICS
instead. The specification actually leaves this behavior undefined, saying that portable applications should not rely on any specific behavior for aList
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 truelist
with 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
OrderColumn
annotation 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 inOrderBy
lists 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 anIllegalStateException
must 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 anEntityNotFoundException
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.
- 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, anInteger
argument 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
-
-