Class MutableJpaComplianceImpl
- java.lang.Object
-
- org.hibernate.jpa.internal.MutableJpaComplianceImpl
-
- All Implemented Interfaces:
JpaCompliance,MutableJpaCompliance
public class MutableJpaComplianceImpl extends Object implements MutableJpaCompliance
-
-
Constructor Summary
Constructors Constructor Description MutableJpaComplianceImpl(Map<?,?> configurationSettings)MutableJpaComplianceImpl(Map<?,?> configurationSettings, boolean jpaByDefault)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JpaComplianceimmutableCopy()booleanisGlobalGeneratorScopeEnabled()Should the scope ofTableGenerator.name()andSequenceGenerator.name()be considered globally or locally defined?booleanisJpaCacheComplianceEnabled()Should Hibernate comply with all aspects of caching as defined by JPA? Or can it deviate to perform things it believes will be "better"?booleanisJpaClosedComplianceEnabled()JPA defines specific exceptions on specific methods when called onEntityManagerandEntityManagerFactorywhen those objects have been closed.booleanisJpaListComplianceEnabled()Controls how Hibernate interprets a mappedListwithout no order column specified.booleanisJpaOrderByMappingComplianceEnabled()Should we strictly handleOrderByexpressions?booleanisJpaProxyComplianceEnabled()JPA spec says that anEntityNotFoundExceptionshould be thrown when accessing an entity proxy which does not have an associated table row in the database.booleanisJpaQueryComplianceEnabled()Controls whether Hibernate's handling of JPA'sQuery(JPQL, Criteria and native-query) should strictly follow the JPA spec.booleanisJpaTransactionComplianceEnabled()Indicates that Hibernate'sTransactionshould behave as defined by the specification for JPA'sEntityTransactionsince it extends it.booleanisLoadByIdComplianceEnabled()JPA says that the id passed toEntityManager.getReference(java.lang.Class<T>, java.lang.Object)andEntityManager.find(java.lang.Class<T>, java.lang.Object)should be exactly the expected type, allowing no type coercion.voidsetCachingCompliance(boolean cachingCompliance)voidsetClosedCompliance(boolean closedCompliance)voidsetGeneratorNameScopeCompliance(boolean enabled)voidsetListCompliance(boolean listCompliance)voidsetLoadByIdCompliance(boolean enabled)voidsetOrderByMappingCompliance(boolean orderByMappingCompliance)voidsetProxyCompliance(boolean proxyCompliance)voidsetQueryCompliance(boolean queryCompliance)voidsetTransactionCompliance(boolean transactionCompliance)
-
-
-
Method Detail
-
isJpaQueryComplianceEnabled
public boolean isJpaQueryComplianceEnabled()
Description copied from interface:JpaComplianceControls whether Hibernate's handling of JPA'sQuery(JPQL, Criteria and native-query) should strictly follow the JPA spec. This includes parsing and translating a query as JPQL instead of HQL, as well as whether calls to theQuerymethods always throw the exceptions defined by the specification.Deviations result in an exception, if enabled.
- Specified by:
isJpaQueryComplianceEnabledin interfaceJpaCompliance- Returns:
trueindicates to behave in the spec-defined way- See Also:
AvailableSettings.JPA_QUERY_COMPLIANCE
-
isJpaTransactionComplianceEnabled
public boolean isJpaTransactionComplianceEnabled()
Description copied from interface:JpaComplianceIndicates that Hibernate'sTransactionshould behave as defined by the specification for JPA'sEntityTransactionsince it extends it.- Specified by:
isJpaTransactionComplianceEnabledin interfaceJpaCompliance- Returns:
trueindicates to behave in the spec-defined way- See Also:
AvailableSettings.JPA_TRANSACTION_COMPLIANCE
-
isJpaListComplianceEnabled
public boolean isJpaListComplianceEnabled()
Description copied from interface:JpaComplianceControls how Hibernate interprets a mappedListwithout no order column specified. Historically Hibernate treats this as a "bag", which is a concept JPA does not have.- Specified by:
isJpaListComplianceEnabledin interfaceJpaCompliance- Returns:
trueindicates to behave in the spec-defined way, interpreting the mapping as a "list", rather than a "bag"- See Also:
AvailableSettings.JPA_LIST_COMPLIANCE
-
isJpaClosedComplianceEnabled
public boolean isJpaClosedComplianceEnabled()
Description copied from interface:JpaComplianceJPA defines specific exceptions on specific methods when called onEntityManagerandEntityManagerFactorywhen those objects have been closed. This setting controls whether the spec defined behavior or Hibernate's behavior will be used.If enabled Hibernate will operate in the JPA specified way throwing exceptions when the spec says it should with regard to close checking
- Specified by:
isJpaClosedComplianceEnabledin interfaceJpaCompliance- Returns:
trueindicates to behave in the spec-defined way- See Also:
AvailableSettings.JPA_CLOSED_COMPLIANCE
-
isJpaProxyComplianceEnabled
public boolean isJpaProxyComplianceEnabled()
Description copied from interface:JpaComplianceJPA spec says that anEntityNotFoundExceptionshould be thrown when accessing an entity proxy which does not have an associated table row in the database.Traditionally, Hibernate does not initialize an entity Proxy when accessing its identifier since we already know the identifier value, hence we can save a database round trip.
If enabled Hibernate will initialize the entity proxy even when accessing its identifier.
- Specified by:
isJpaProxyComplianceEnabledin interfaceJpaCompliance- Returns:
trueindicates to behave in the spec-defined way- See Also:
AvailableSettings.JPA_PROXY_COMPLIANCE
-
isJpaCacheComplianceEnabled
public boolean isJpaCacheComplianceEnabled()
Description copied from interface:JpaComplianceShould Hibernate comply with all aspects of caching as defined by JPA? Or can it deviate to perform things it believes will be "better"?- Specified by:
isJpaCacheComplianceEnabledin interfaceJpaCompliance- Returns:
trueindicates to behave in the spec-defined way- See Also:
AvailableSettings.JPA_CACHING_COMPLIANCE,AbstractEntityPersister.isCacheInvalidationRequired()
-
isGlobalGeneratorScopeEnabled
public boolean isGlobalGeneratorScopeEnabled()
Description copied from interface:JpaComplianceShould the scope ofTableGenerator.name()andSequenceGenerator.name()be considered globally or locally defined?- Specified by:
isGlobalGeneratorScopeEnabledin interfaceJpaCompliance- Returns:
trueif the generator name scope is considered global- See Also:
AvailableSettings.JPA_ID_GENERATOR_GLOBAL_SCOPE_COMPLIANCE
-
isJpaOrderByMappingComplianceEnabled
public boolean isJpaOrderByMappingComplianceEnabled()
Description copied from interface:JpaComplianceShould we strictly handleOrderByexpressions?JPA says the order-items can only be attribute references whereas Hibernate supports a wide range of items. With this enabled, Hibernate will throw a compliance error when a non-attribute-reference is used.
- Specified by:
isJpaOrderByMappingComplianceEnabledin interfaceJpaCompliance- See Also:
AvailableSettings.JPA_ORDER_BY_MAPPING_COMPLIANCE
-
isLoadByIdComplianceEnabled
public boolean isLoadByIdComplianceEnabled()
Description copied from interface:JpaComplianceJPA says that the id passed toEntityManager.getReference(java.lang.Class<T>, java.lang.Object)andEntityManager.find(java.lang.Class<T>, java.lang.Object)should be exactly the expected type, allowing no type coercion.Historically, Hibernate behaved the same way. Since 6.0 however, Hibernate has the ability to coerce the passed type to the expected type. For example, an
Integermay be widened toLong. Coercion is performed by callingJavaType.coerce(X, org.hibernate.type.descriptor.java.JavaType.CoercionContext).This setting controls whether such coercion should be allowed.
- Specified by:
isLoadByIdComplianceEnabledin interfaceJpaCompliance- See Also:
AvailableSettings.JPA_LOAD_BY_ID_COMPLIANCE
-
setListCompliance
public void setListCompliance(boolean listCompliance)
- Specified by:
setListCompliancein interfaceMutableJpaCompliance
-
setOrderByMappingCompliance
public void setOrderByMappingCompliance(boolean orderByMappingCompliance)
- Specified by:
setOrderByMappingCompliancein interfaceMutableJpaCompliance
-
setProxyCompliance
public void setProxyCompliance(boolean proxyCompliance)
- Specified by:
setProxyCompliancein interfaceMutableJpaCompliance
-
setGeneratorNameScopeCompliance
public void setGeneratorNameScopeCompliance(boolean enabled)
- Specified by:
setGeneratorNameScopeCompliancein interfaceMutableJpaCompliance
-
setQueryCompliance
public void setQueryCompliance(boolean queryCompliance)
- Specified by:
setQueryCompliancein interfaceMutableJpaCompliance
-
setTransactionCompliance
public void setTransactionCompliance(boolean transactionCompliance)
- Specified by:
setTransactionCompliancein interfaceMutableJpaCompliance
-
setClosedCompliance
public void setClosedCompliance(boolean closedCompliance)
- Specified by:
setClosedCompliancein interfaceMutableJpaCompliance
-
setCachingCompliance
public void setCachingCompliance(boolean cachingCompliance)
- Specified by:
setCachingCompliancein interfaceMutableJpaCompliance
-
setLoadByIdCompliance
public void setLoadByIdCompliance(boolean enabled)
- Specified by:
setLoadByIdCompliancein interfaceMutableJpaCompliance
-
immutableCopy
public JpaCompliance immutableCopy()
- Specified by:
immutableCopyin interfaceMutableJpaCompliance
-
-