Class Compatibility
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAllow non-compliant extensions of JPQL.static final intIf a JPQL statement is not compliant with the JPA specification, fail to parse it.static final intIf a JPQL statement is not compliant with the JPA specification, warn the first time that statement is parsed. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhetherCriteriaBuilder.tuple()andCriteriaBuilder.array()accept compound selections as arguments.booleanWhether to turn collection/map tracing off in case of more number of modifications.booleanWhether the SQL generated for queries executed with a modified fetch plan are cached.booleanWhether openjpa will always cascade on detach, regardless of the cascade setting.booleanWhether OpenJPA will check the database for an Entity when cascading a persist to another Entity.booleanWhether a bulk delete removes the rows of the join tables and element collection tables owned by the deleted entities.booleanWhether to close the broker when the managed transaction commits.booleanbooleanWhether to copy identity objects before returning them to client code.booleanAffirms if detached entities are copy of the managed instances.booleanWhether a named generator that asks for a database sequence is backed by a table sequence when the database has no sequence objects at all, i.e.booleanWhether the metadata processor should filter classes dispatched by the PCRegistry listener system.booleanWhether a bulk update or delete that has to be executed in memory flushes the persistence context afterwards.booleanWhether OpenJPA should flush changes before detaching or serializing an entity.booleanWhether OpenJPA should ignore the DetachedStateField value when determining if our Proxy classes should be removed during serialization.intgetJPQL()Whether or not JPQL extensions are allowed.booleanWhether an attribute without a mapping annotation of its own whose type is not serializable is mapped as a basic attribute when an auto-apply converter (@Converter(autoApply = true)) is registered for its type.booleanWhetherQuery.getResultList()copies the query result into aArrayList.booleanWhether the MetaDataFactory and MappingFactory should be set to strict mode.booleanWhether or not to perform a version check on instances being updated in a datastore transaction.booleanWhether to temporally override the thread's Context Classloader when processing ORM XML documents to avoid deadlock potential with certain Classloader hierarchy configurations.booleanWhether OpenJPA will scan every persistent class in an XML mapping file for annotations prior to executing a query.booleanWhether OpenJPA allows private, non-transient properties to be persistent.booleanWhether to interpret quoted numbers in query strings as numbers.booleanWhether OpenJPA should attempt to load fields when the DetachState option is set to loaded.booleanWhether OpenJPA should reset the internal state (flush flag) when cascading a persist to another Entity.booleanWhether the type arguments of anAttributeConverter<X, Y>are resolved through the whole type hierarchy of the converter class.booleanThis property is used to specify whether the aggregate query functions SUM, AVG, MAX, and MIN return null if there is no query result.booleanWhether to enable JPA spec-compliant schema generation behavior.booleanWhether if map and collection in entity are stored as blob.booleanWhether to require exact identity value types when creating object ids from a class and value.booleanWhether to add class criteria for super class discreminator strategy.booleanWhether the dictionaries use the reserved words of the current database versions that were added in 4.2.0, and the naming that comes with them.booleanWhether OpenJPA should use the new default order column name defined by JPA 2.0: name; "_"; "ORDER" or the pre-JPA 2.0 default name "ordr".booleanThis property can be used to allow OpenJPA to use ListAttributes for all types of Arrays, not just those with the @ PersistentCollection annotation.booleanWhether OpenJPA should use the default map key column name defined by section 11.1.35 of the specification: name; "_"; "KEY" or the name used before OpenJPA 4.2.0, "key" (which dictionaries usually turn into "KEY0", as "KEY" is a reserved word).booleanWhether to return hollow instances to broker lookups with avalidateparameter of false.booleanWhether to check the datastore for the existence of a nontransactional cached object in broker lookups with avalidateparameter of true.booleanWhether OpenJPA allows bi-directional relationship in the MappedSuperclass.booleanWhether OpenJPA allows non-default entity relationship mapping.booleanReturns true if life cycle event manager is a singleton configuration.voidsetAbstractMappingUniDirectional(boolean isAbstractMappingUniDirectional) Whether OpenJPA allows bi-directional relationship in the MappedSuperclass.voidsetAllowNestedCompoundSelection(boolean b) WhetherCriteriaBuilder.tuple()andCriteriaBuilder.array()accept compound selections as arguments.voidsetAutoOff(boolean autoOff) Whether to turn collection/map tracing off in case of more number of modifications.voidsetCacheNonDefaultFetchPlanQueries(boolean bool) Whether the SQL generated for queries executed with a modified fetch plan are cached.voidsetCascadeWithDetach(boolean cascadeWithDetach) Whether openjpa should always cascade on detach, regardless of the cascade setting.voidWhether OpenJPA will check the database for an Entity when cascading a persist to another Entity.voidsetCleanupOwnedTablesOnBulkDelete(boolean b) Whether a bulk delete removes the rows of the join tables and element collection tables owned by the deleted entities.voidsetCloseOnManagedCommit(boolean close) Whether to close the broker when the managed transaction commits.voidsetConvertPositionalParametersToNamed(boolean c) voidsetCopyObjectIds(boolean copy) Whether to copy identity objects before returning them to client code.voidsetCopyOnDetach(boolean copyOnDetach) Sets if detached entities are copy of the managed instances.voidsetEmulateNativeSequences(boolean b) Whether a named generator that asks for a database sequence is backed by a table sequence when the database has no sequence objects at all.voidsetFilterPCRegistryClasses(boolean bool) Whether the metadata processor should filter classes dispatched by the PCRegistry listener system.voidsetFlushAfterInMemoryBulkOperation(boolean b) Whether a bulk update or delete that has to be executed in memory flushes the persistence context afterwards.voidsetFlushBeforeDetach(boolean beforeDetach) Whether OpenJPA should flush changes before detaching or serializing an entity.voidsetIgnoreDetachedStateFieldForProxySerialization(boolean ignoreDSF) Whether OpenJPA should ignore the DetachedStateField value when determining if our Proxy classes should be removed during serialization.voidWhether or not JPQL extensions are allowed.voidsetMapAutoApplyConvertedFields(boolean b) Whether an attribute whose type is not serializable is mapped as a basic attribute when an auto-apply converter is registered for its type.voidsetMaterializeQueryResultList(boolean b) WhetherQuery.getResultList()copies the query result into aArrayList.voidsetMetaFactoriesAreStrict(boolean metaFactoriesAreStrict) Set whether MetaDataFactories and MappingFactories will be strictly separate.voidsetNonDefaultMappingAllowed(boolean isNonDefaultMappingAllowed) Whether OpenJPA allows non-default entity relationship mapping.voidsetNonOptimisticVersionCheck(boolean nonOptimisticVersionCheck) Whether or not to perform a version check on instances being updated in a datastore transaction.voidsetOverrideContextClassloader(boolean overrideContextClassloader) Whether to temporally override the thread's Context Classloader when processing ORM XML documents to avoid deadlock potential with certain Classloader hierarchy configurations.voidsetParseAnnotationsForQueryMode(boolean parseAnnotationsForQueryMode) Whether OpenJPA will scan every persistent class in an XML mapping file for annotations prior to executing a query.voidsetPrivatePersistentProperties(boolean privateProps) Whether OpenJPA allows private, non-transient properties to be persistent.voidsetQuotedNumbersInQueries(boolean quotedNumbers) Whether to interpret quoted numbers in query strings as numbers.voidsetReloadOnDetach(boolean reloadOnDetach) Whether OpenJPA should attempt to load fields when the DetachState option is set to loaded.voidsetResetFlushFlagForCascadePersist(boolean b) Whether OpenJPA should reset the internal state (flush flag) when cascading a persist to another Entity.voidsetResolveConverterTypeHierarchy(boolean b) Whether the type arguments of anAttributeConverterare resolved through the whole type hierarchy of the converter class.voidsetReturnNullOnAggregateResult(boolean returnNullOnEmptyAggregateResult) This property is used to specify whether the aggregate query functions SUM, AVG, MAX, and MIN return null if there is no query result.voidsetSingletonLifecycleEventManager(boolean singleton) This property set whether each EntityManager has its own life cycle event manager.voidsetSpecCompliantSchemaGeneration(boolean b) Whether to enable JPA spec-compliant schema generation behavior.voidsetStoreMapCollectionInEntityAsBlob(boolean storeAsBlob) Whether if map and collection in entity are stored as blob.voidsetStrictIdentityValues(boolean strictVals) Whether to require exact identity value types when creating object ids from a class and value.voidsetSuperclassDiscriminatorStrategyByDefault(boolean superclassDiscriminatorStrategyByDefault) Whether to add class criteria for super class discreminator strategy.voidsetUpdatedReservedWords(boolean b) Whether the dictionaries use the reserved words of the current database versions that were added in 4.2.0.voidsetUseJPA2DefaultOrderColumnName(boolean useJPA2Name) Whether OpenJPA should use the new default order column name defined by JPA 2.0: name; "_"; "ORDER" or the pre-JPA 2.0 default name "ordr".voidsetUseListAttributeForArrays(boolean useListAttribute) This property can be used to allow OpenJPA to use ListAttributes for all types of Arrays, not just those with the @PersistentCollection annotation.voidsetUseSpecDefaultMapKeyColumnName(boolean useSpecName) Whether OpenJPA should use the default map key column name defined by section 11.1.35 of the specification: name; "_"; "KEY" or the name used before OpenJPA 4.2.0, "key" (which dictionaries usually turn into "KEY0", as "KEY" is a reserved word).voidsetValidateFalseReturnsHollow(boolean hollow) Whether to return hollow instances to broker lookups with avalidateparameter of false.voidsetValidateTrueChecksStore(boolean check) Whether to check the datastore for the existence of a nontransactional cached object in broker lookups with avalidateparameter of true.
-
Field Details
-
JPQL_STRICT
public static final int JPQL_STRICTIf a JPQL statement is not compliant with the JPA specification, fail to parse it.- Since:
- 1.1.0
- See Also:
-
JPQL_WARN
public static final int JPQL_WARNIf a JPQL statement is not compliant with the JPA specification, warn the first time that statement is parsed.- Since:
- 1.1.0
- See Also:
-
JPQL_EXTENDED
public static final int JPQL_EXTENDEDAllow non-compliant extensions of JPQL.- Since:
- 1.1.0
- See Also:
-
-
Constructor Details
-
Compatibility
public Compatibility()
-
-
Method Details
-
getStrictIdentityValues
public boolean getStrictIdentityValues()Whether to require exact identity value types when creating object ids from a class and value. Defaults to false. -
setStrictIdentityValues
public void setStrictIdentityValues(boolean strictVals) Whether to require exact identity value types when creating object ids from a class and value. Defaults to false. -
getAutoOff
public boolean getAutoOff()Whether to turn collection/map tracing off in case of more number of modifications. Defaults to true. -
setAutoOff
public void setAutoOff(boolean autoOff) Whether to turn collection/map tracing off in case of more number of modifications. Defaults to true. -
getSuperclassDiscriminatorStrategyByDefault
public boolean getSuperclassDiscriminatorStrategyByDefault()Whether to add class criteria for super class discreminator strategy. Defaults to false. -
setSuperclassDiscriminatorStrategyByDefault
public void setSuperclassDiscriminatorStrategyByDefault(boolean superclassDiscriminatorStrategyByDefault) Whether to add class criteria for super class discreminator strategy. Defaults to false. -
getQuotedNumbersInQueries
public boolean getQuotedNumbersInQueries()Whether to interpret quoted numbers in query strings as numbers. OpenJPA versions 0.3.1 and prior treated them as numbers; more recent versions treat them as strings. -
setQuotedNumbersInQueries
public void setQuotedNumbersInQueries(boolean quotedNumbers) Whether to interpret quoted numbers in query strings as numbers. OpenJPA versions 0.3.1 and prior treated them as numbers; more recent versions treat them as strings. -
getValidateFalseReturnsHollow
public boolean getValidateFalseReturnsHollow()Whether to return hollow instances to broker lookups with avalidateparameter of false. OpenJPA versions prior to 0.4.0 did not return hollow instances without special configuration (theObjectLookupMode). Beginning with 0.4.0, hollow objects are the default. -
setValidateFalseReturnsHollow
public void setValidateFalseReturnsHollow(boolean hollow) Whether to return hollow instances to broker lookups with avalidateparameter of false. OpenJPA versions prior to 0.4.0 did not return hollow instances without special configuration (theObjectLookupMode). Beginning with 0.4.0, hollow objects are the default. -
getValidateTrueChecksStore
public boolean getValidateTrueChecksStore()Whether to check the datastore for the existence of a nontransactional cached object in broker lookups with avalidateparameter of true. OpenJPA versions prior to 0.4.0 checked the datastore. -
setValidateTrueChecksStore
public void setValidateTrueChecksStore(boolean check) Whether to check the datastore for the existence of a nontransactional cached object in broker lookups with avalidateparameter of true. OpenJPA versions prior to 0.4.0 checked the datastore. -
getCopyObjectIds
public boolean getCopyObjectIds()Whether to copy identity objects before returning them to client code. Versions of OpenJPA prior to 0.3.0 always copied identity objects. Also, you should configure OpenJPA to copy identity objects if you mutate them after use. -
setCopyObjectIds
public void setCopyObjectIds(boolean copy) Whether to copy identity objects before returning them to client code. Versions of OpenJPA prior to 0.3.0 always copied identity objects. Also, you should configure OpenJPA to copy identity objects if you mutate them after use. -
getCloseOnManagedCommit
public boolean getCloseOnManagedCommit()Whether to close the broker when the managed transaction commits. Versions of OpenJPA prior to 0.3.0 did not close the broker. -
setCloseOnManagedCommit
public void setCloseOnManagedCommit(boolean close) Whether to close the broker when the managed transaction commits. Versions of OpenJPA prior to 0.3.0 did not close the broker. -
setNonOptimisticVersionCheck
public void setNonOptimisticVersionCheck(boolean nonOptimisticVersionCheck) Whether or not to perform a version check on instances being updated in a datastore transaction. Version of OpenJPA prior to 0.4.1 always forced a version check. -
getNonOptimisticVersionCheck
public boolean getNonOptimisticVersionCheck()Whether or not to perform a version check on instances being updated in a datastore transaction. Version of OpenJPA prior to 0.4.1 always forced a version check. -
getJPQL
public int getJPQL()Whether or not JPQL extensions are allowed. Defaults toJPQL_STRICT.- Since:
- 1.1.0
- See Also:
-
setJPQL
Whether or not JPQL extensions are allowed. Possible values: "warn", "strict", "extended".- Since:
- 1.1.0
- See Also:
-
getStoreMapCollectionInEntityAsBlob
public boolean getStoreMapCollectionInEntityAsBlob()Whether if map and collection in entity are stored as blob. Defaults tofalse.- Since:
- 1.1.0
-
setStoreMapCollectionInEntityAsBlob
public void setStoreMapCollectionInEntityAsBlob(boolean storeAsBlob) Whether if map and collection in entity are stored as blob. Defaults tofalse.- Since:
- 1.1.0
-
getFlushBeforeDetach
public boolean getFlushBeforeDetach()Whether OpenJPA should flush changes before detaching or serializing an entity. In JPA this is usually false, but other persistence frameworks (ie JDO) may expect it to be true.Prior to version 1.0.3 and 1.2.0 changes were always flushed.
- Returns:
- true if changes should be flushed, otherwise false.
- Since:
- 1.0.3, 1.2.0
-
setIgnoreDetachedStateFieldForProxySerialization
public void setIgnoreDetachedStateFieldForProxySerialization(boolean ignoreDSF) Whether OpenJPA should ignore the DetachedStateField value when determining if our Proxy classes should be removed during serialization.Starting with version 2.0.0, when the DetachedStateFiled==true, the build time $proxy classes will not be removed.
Prior to version 2.0.0, the DetachedStateFiled was not used and the $proxy classes were not being removed during serialization after the Persistence context was cleared.
- Parameters:
ignoreDSF- if true the old Proxy serialization behavior will be used.- Since:
- 2.0.0
-
getIgnoreDetachedStateFieldForProxySerialization
public boolean getIgnoreDetachedStateFieldForProxySerialization()Whether OpenJPA should ignore the DetachedStateField value when determining if our Proxy classes should be removed during serialization.Starting with version 2.0.0, when the DetachedStateFiled==true, the build time $proxy classes will not be removed.
Prior to version 2.0.0, the DetachedStateFiled was not used and the $proxy classes were not being removed during serialization after the Persistence context was cleared.
- Returns:
- true if the old Proxy serialization will be used, otherwise false.
- Since:
- 2.0.0
-
getConvertPositionalParametersToNamed
public boolean getConvertPositionalParametersToNamed() -
setConvertPositionalParametersToNamed
public void setConvertPositionalParametersToNamed(boolean c) -
setFlushBeforeDetach
public void setFlushBeforeDetach(boolean beforeDetach) Whether OpenJPA should flush changes before detaching or serializing an entity. In JPA this is usually false, but other persistence frameworks (ie JDO) may expect it to be true.Prior to version 1.0.3 and 1.2.0 changes were always flushed.
- Parameters:
beforeDetach- if true changes will be flushed before detaching or serializing an entity.- Since:
- 1.0.3, 1.2.0
-
getCopyOnDetach
public boolean getCopyOnDetach()Affirms if detached entities are copy of the managed instances. Before this option is introduced, detached entities were by default copies of the managed entities unless the entire cache is detached, only then the detachment was in-place. This option changes the default behavior such that detachment is now in-place by default. To emulate the previous copy-on-detach behavior set this option to true. If the entire cache is being detached (when the persistence context is closed, for example), the detachement- Since:
- 2.0.0
-
setCopyOnDetach
public void setCopyOnDetach(boolean copyOnDetach) Sets if detached entities are copy of the managed instances. Before this option is introduced, detached entities were by default copies of the managed entities unless the entire cache is detached, only then the detachment was in-place. This option changes the default behavior such that detachment is now in-place by default. To emulate the previous copy-on-detach behavior set this option to true.- Since:
- 2.0.0
-
getCascadeWithDetach
public boolean getCascadeWithDetach()Whether openjpa will always cascade on detach, regardless of the cascade setting.- Returns:
- true if cascade will always occur, false if cascade will only occur if it is specified in metadata
- Since:
- 2.0.0
-
setCascadeWithDetach
public void setCascadeWithDetach(boolean cascadeWithDetach) Whether openjpa should always cascade on detach, regardless of the cascade setting.- Parameters:
cascadeWithDetach- true if cascade should always occur, false if it should only occur if specified in metadata- Since:
- 2.0.0
-
getUseJPA2DefaultOrderColumnName
public boolean getUseJPA2DefaultOrderColumnName()Whether OpenJPA should use the new default order column name defined by JPA 2.0: name; "_"; "ORDER" or the pre-JPA 2.0 default name "ordr".- Returns:
- true if the JPA2 default name should be used
- Since:
- 2.0.0
-
setUseJPA2DefaultOrderColumnName
public void setUseJPA2DefaultOrderColumnName(boolean useJPA2Name) Whether OpenJPA should use the new default order column name defined by JPA 2.0: name; "_"; "ORDER" or the pre-JPA 2.0 default name "ordr".- Parameters:
useJPA2Name- true if the JPA 2.0 default name should be used. false if the 1.x name should be used.- Since:
- 2.0.0
-
getUseSpecDefaultMapKeyColumnName
public boolean getUseSpecDefaultMapKeyColumnName()Whether OpenJPA should use the default map key column name defined by section 11.1.35 of the specification: name; "_"; "KEY" or the name used before OpenJPA 4.2.0, "key" (which dictionaries usually turn into "KEY0", as "KEY" is a reserved word).- Returns:
- true if the specification default name should be used
- Since:
- 4.2.0
-
setUseSpecDefaultMapKeyColumnName
public void setUseSpecDefaultMapKeyColumnName(boolean useSpecName) Whether OpenJPA should use the default map key column name defined by section 11.1.35 of the specification: name; "_"; "KEY" or the name used before OpenJPA 4.2.0, "key" (which dictionaries usually turn into "KEY0", as "KEY" is a reserved word).- Parameters:
useSpecName- true if the specification default name should be used. false if the pre-4.2.0 name should be used.- Since:
- 4.2.0
-
getPrivatePersistentProperties
public boolean getPrivatePersistentProperties()Whether OpenJPA allows private, non-transient properties to be persistent. Prior to OpenJPA 2.0, if property access was used, private properties were considered persistent. This is contrary to the JPA specification, which states that persistent properties must be public or protected. The default value is false.- Returns:
- true if non-transient private properties should be persistent
- Since:
- 2.0.0
-
setPrivatePersistentProperties
public void setPrivatePersistentProperties(boolean privateProps) Whether OpenJPA allows private, non-transient properties to be persistent. Prior to OpenJPA 2.0, if property access was used, private properties were considered persistent. This is contrary to the JPA specification, which states that persistent properties must be public or protected.- Parameters:
privateProps- true if non-transient private properties should be persistent- Since:
- 2.0.0
-
setAbstractMappingUniDirectional
public void setAbstractMappingUniDirectional(boolean isAbstractMappingUniDirectional) Whether OpenJPA allows bi-directional relationship in the MappedSuperclass. Prior to OpenJPA 2.0, the bi-directional relationship in the MappedSuperclass, is not blocked. This is contrary to the JPA specification, which states that persistent relationships defined by a mapped superclass must be unidirectional.- Parameters:
isAbstractMappingUniDirectional- true if relationship defined in the MappedSuperclass must be uni-directional- Since:
- 2.0.0
-
isAbstractMappingUniDirectional
public boolean isAbstractMappingUniDirectional()Whether OpenJPA allows bi-directional relationship in the MappedSuperclass. Prior to OpenJPA 2.0, the bi-directional relationship in the MappedSuperclass, is not blocked. This is contrary to the JPA specification, which states that persistent relationships defined by a mapped superclass must be unidirectional. The default value is false.- Since:
- 2.0.0
-
setNonDefaultMappingAllowed
public void setNonDefaultMappingAllowed(boolean isNonDefaultMappingAllowed) Whether OpenJPA allows non-default entity relationship mapping. Prior to OpenJPA 2.0, the non-default entity relationship mapping is not allowed. JPA 2.0 spec relaxes this restriction. The default value is false.- Since:
- 2.0.0
-
isNonDefaultMappingAllowed
public boolean isNonDefaultMappingAllowed()Whether OpenJPA allows non-default entity relationship mapping. Prior to OpenJPA 2.0, the non-default entity relationship mapping is not allowed. JPA 2.0 spec relaxes this restriction. The default value is false.- Since:
- 2.0.0
-
getReloadOnDetach
public boolean getReloadOnDetach()Whether OpenJPA should attempt to load fields when the DetachState option is set to loaded. This also determines whether a redundant copy of the version field is made. Beginning in 2.0 it defaults to false.- Returns:
- the _reloadOnDetach
- Since:
- 1.2.2
-
setReloadOnDetach
public void setReloadOnDetach(boolean reloadOnDetach) Whether OpenJPA should attempt to load fields when the DetachState option is set to loaded. This also determines whether a redundant copy of the version field is made. Beginning in 2.0 it defaults to false.- Parameters:
reloadOnDetach- the _reloadOnDetach to set- Since:
- 1.2.2
-
getCheckDatabaseForCascadePersistToDetachedEntity
public boolean getCheckDatabaseForCascadePersistToDetachedEntity()Whether OpenJPA will check the database for an Entity when cascading a persist to another Entity. This property only applies for the case where we are trying to cascade a persist to an Entity which doesn't have a StateManager and we can't determine if it is detached.- Since:
- 2.1.1
-
setCheckDatabaseForCascadePersistToDetachedEntity
public void setCheckDatabaseForCascadePersistToDetachedEntity(boolean b) Whether OpenJPA will check the database for an Entity when cascading a persist to another Entity. This property only applies for the case where we are trying to cascade a persist to an Entity which doesn't have a StateManager and we can't determine if it is detached.- Since:
- 2.1.1
-
getOverrideContextClassloader
public boolean getOverrideContextClassloader()Whether to temporally override the thread's Context Classloader when processing ORM XML documents to avoid deadlock potential with certain Classloader hierarchy configurations. Defaults to false. -
setOverrideContextClassloader
public void setOverrideContextClassloader(boolean overrideContextClassloader) Whether to temporally override the thread's Context Classloader when processing ORM XML documents to avoid deadlock potential with certain Classloader hierarchy configurations. Defaults to false. -
getParseAnnotationsForQueryMode
public boolean getParseAnnotationsForQueryMode()Whether OpenJPA will scan every persistent class in an XML mapping file for annotations prior to executing a query. In practice this scan is rarely needed, but the option to enable it is present for compatibility with prior releases.- Returns:
- true if the annotations should be re-parsed when resolving MetaData in MODE_QUERY.
- Since:
- 2.0.2
-
setParseAnnotationsForQueryMode
public void setParseAnnotationsForQueryMode(boolean parseAnnotationsForQueryMode) Whether OpenJPA will scan every persistent class in an XML mapping file for annotations prior to executing a query. In practice this scan is rarely needed, but the option to enable it is present for compatibility with prior releases.- Since:
- 2.0.2
-
getUseListAttributeForArrays
public boolean getUseListAttributeForArrays()This property can be used to allow OpenJPA to use ListAttributes for all types of Arrays, not just those with the @ PersistentCollection annotation. If the canonical metamodel classes were generated in an early version of OpenJPA (e.g. 2.0.0, 2.0.1, or 2.1.0) it is recommended to set this property to true. If you have generated your metamodel classes on later versions of OpenJPA (e.g. 2.2.0) you may want to have this set to false.- Returns:
- true if OpenJPA will use ListAttributes for all arrays, false if OpenJPA will use ListAttributes for only arrays which use the @PersistentCollection annotation.
- Since:
- 2.2.0
-
setUseListAttributeForArrays
public void setUseListAttributeForArrays(boolean useListAttribute) This property can be used to allow OpenJPA to use ListAttributes for all types of Arrays, not just those with the @PersistentCollection annotation. If the canonical metamodel classes were generated in an early version of OpenJPA (e.g. 2.0.0, 2.0.1, or 2.1.0) it is recommended to set this property to true. If you have generated your metamodel classes on later versions of OpenJPA (e.g. 2.2.0) you may want to have this set to false.- Parameters:
useListAttribute- whether OpenJPA will use ListAttributes for all arrays.- Since:
- 2.2.0
-
getMetaFactoriesAreStrict
public boolean getMetaFactoriesAreStrict()Whether the MetaDataFactory and MappingFactory should be set to strict mode. If strict mode is used a MetaDataFactory will only resolve MetaData (no JDBC mappings), and a MappingFactory will only resolve Mapping information.- Returns:
- Whether strict mode should be used.
- Since:
- 2.2.0
-
setMetaFactoriesAreStrict
public void setMetaFactoriesAreStrict(boolean metaFactoriesAreStrict) Set whether MetaDataFactories and MappingFactories will be strictly separate.- Parameters:
metaFactoriesAreStrict- True if the MetaDataFactory should only process metadata, and the MappingFactory should only process mappings.- Since:
- 2.2.0
-
getResetFlushFlagForCascadePersist
public boolean getResetFlushFlagForCascadePersist()Whether OpenJPA should reset the internal state (flush flag) when cascading a persist to another Entity. That is, when a flush is performed, OpenJPA keep state to indicate the flush has been performed. In certain cascade persist scenarios the fact that a flush has been performed prior to a cascade persist can cause certain entities to not be written to the database given the prior flush. This property, when set, will cause the flush flag to be reset in cascade scenarios. For more details see JIRA OPENJPA-2051- Since:
- 2.0.x
-
setResetFlushFlagForCascadePersist
public void setResetFlushFlagForCascadePersist(boolean b) Whether OpenJPA should reset the internal state (flush flag) when cascading a persist to another Entity. That is, when a flush is performed, OpenJPA keep state to indicate the flush has been performed. In certain cascade persist scenarios the fact that a flush has been performed prior to a cascade persist can cause certain entities to not be written to the database given the prior flush. This property, when set, will cause the flush flag to be reset in cascade scenarios. For more details see JIRA OPENJPA-2051- Since:
- 2.0.x
-
isSingletonLifecycleEventManager
public boolean isSingletonLifecycleEventManager()Returns true if life cycle event manager is a singleton configuration. -
setSingletonLifecycleEventManager
public void setSingletonLifecycleEventManager(boolean singleton) This property set whether each EntityManager has its own life cycle event manager. By default, each EntityManager only fires events to the registered listeners to the entities it manages. If the life cycle event manager is a singleton, events will be fired to listeners registered to all instances of EntityManager in the same persistence unit. -
getFilterPCRegistryClasses
public boolean getFilterPCRegistryClasses()Whether the metadata processor should filter classes dispatched by the PCRegistry listener system. -
setFilterPCRegistryClasses
public void setFilterPCRegistryClasses(boolean bool) Whether the metadata processor should filter classes dispatched by the PCRegistry listener system. -
getReturnNullOnEmptyAggregateResult
public boolean getReturnNullOnEmptyAggregateResult()This property is used to specify whether the aggregate query functions SUM, AVG, MAX, and MIN return null if there is no query result. This will occur if no rows are returned for the specified query predicate. The default is false, meaning that 0 will be returned for functions operating on numeric data. In compliance with the JPA specification, the default value is true.- Returns:
- true if the result of an aggregate with an empty query result returns null.
- Since:
-
setReturnNullOnAggregateResult
public void setReturnNullOnAggregateResult(boolean returnNullOnEmptyAggregateResult) This property is used to specify whether the aggregate query functions SUM, AVG, MAX, and MIN return null if there is no query result. This will occur if no rows are returned for the specified query predicate. The default is false, meaning that 0 will be returned for functions operating on numeric data. In compliance with the JPA specification, the default value is true.- Parameters:
returnNullOnEmptyAggregateResult- whether OpenJPA will return null for aggregate expressions when the query result is empty.- Since:
-
getCacheNonDefaultFetchPlanQueries
public boolean getCacheNonDefaultFetchPlanQueries()Whether the SQL generated for queries executed with a modified fetch plan are cached. -
setCacheNonDefaultFetchPlanQueries
public void setCacheNonDefaultFetchPlanQueries(boolean bool) Whether the SQL generated for queries executed with a modified fetch plan are cached. -
getSpecCompliantSchemaGeneration
public boolean getSpecCompliantSchemaGeneration()Whether to enable JPA spec-compliant schema generation behavior. When true, an explicitdatabase.action=dropviaPersistence.generateSchema()will suppress a subsequentSynchronizeMappings=buildSchemafrom re-creating tables for the same JDBC URL. Defaults to false.- Since:
- 4.2.0
-
setSpecCompliantSchemaGeneration
public void setSpecCompliantSchemaGeneration(boolean b) Whether to enable JPA spec-compliant schema generation behavior.- Since:
- 4.2.0
-
getMaterializeQueryResultList
public boolean getMaterializeQueryResultList()WhetherQuery.getResultList()copies the query result into aArrayList. When true (the default) the complete result is materialized before it is returned, so the list is mutable and remains usable after the query or theEntityManagerhas been closed. When false, the lazyorg.apache.openjpa.lib.rop.ResultListof releases before 4.2.0 is returned, which streams rows on demand according toopenjpa.FetchBatchSizeand becomes invalid on close.- Since:
- 4.2.0
-
setMaterializeQueryResultList
public void setMaterializeQueryResultList(boolean b) WhetherQuery.getResultList()copies the query result into aArrayList. Set to false to restore the lazy, streaming result list of releases before 4.2.0.- Since:
- 4.2.0
-
getAllowNestedCompoundSelection
public boolean getAllowNestedCompoundSelection()WhetherCriteriaBuilder.tuple()andCriteriaBuilder.array()accept compound selections as arguments. The specification forbids nesting a compound selection in another one, which OpenJPA rejects with anIllegalArgumentExceptionby default. Set to true to restore the historic OpenJPA extension that allowed arbitrarily nested tuple and array selections.- Since:
- 4.2.0
-
setAllowNestedCompoundSelection
public void setAllowNestedCompoundSelection(boolean b) WhetherCriteriaBuilder.tuple()andCriteriaBuilder.array()accept compound selections as arguments.- Since:
- 4.2.0
-
getCleanupOwnedTablesOnBulkDelete
public boolean getCleanupOwnedTablesOnBulkDelete()Whether a bulk delete removes the rows of the join tables and element collection tables owned by the deleted entities. A bulk delete never cascades to related entities, but the rows of the tables owned by a deleted entity are not entities themselves and would dangle on deleted primary keys otherwise. Defaults to true; set to false to leave those rows behind. A candidate that owns a bi-directional join table then has to be deleted in memory, because the SQL bulk delete cannot maintain that table; the in-memory path loads the matching instances and deletes them one row at a time rather than with a single bulk statement.A delete without any criteria empties the owned tables outright. A filtered delete materializes the primary keys of the matching candidates first and deletes by those keys, so it holds them in memory, spends a configured query timeout per statement rather than per operation, and evaluates the criteria in a statement of its own.
- Since:
- 4.2.0
-
setCleanupOwnedTablesOnBulkDelete
public void setCleanupOwnedTablesOnBulkDelete(boolean b) Whether a bulk delete removes the rows of the join tables and element collection tables owned by the deleted entities.- Since:
- 4.2.0
-
getFlushAfterInMemoryBulkOperation
public boolean getFlushAfterInMemoryBulkOperation()Whether a bulk update or delete that has to be executed in memory flushes the persistence context afterwards. The in-memory path applies the operation to the managed instances rather than to the database, so without the flushexecuteUpdate()reports a row count that no statement has carried to the database yet, and the operation is lost altogether if the context is cleared before it is committed. Defaults to true.The flush is not restricted to the affected instances - the kernel only flushes the whole transactional cache - so unrelated pending changes of the same context are written as well. Jakarta Persistence 3.1 section 4.10 states that "the persistence context is not synchronized with the result of the bulk update or delete", so neither flushing nor not flushing is mandated; set this to false to restore the 4.1.x timing, in which nothing is written until the next flush or commit. Suppressing the flush does not suppress the operation itself: the matching instances are still modified or marked for deletion in the persistence context and are written by the next flush or at commit.
The flush also decides when the lifecycle callbacks of the affected instances run:
@PostRemoveand@PostUpdate(AFTER_DELETE_PERFORMEDandAFTER_UPDATE_PERFORMED) fire during a flush, so they run insideexecuteUpdate()by default and at the next flush or at commit when this is false.The flush after the operation is skipped regardless of this setting when the runtime cannot flush incrementally, that is when
OpenJPAConfiguration.OPTION_INC_FLUSHis not supported or a savepoint is set that the configuredSavepointManagercannot flush incrementally. The behaviour is then the same as with this option turned off. This covers the flush after the operation only: the flush before the candidate query is not guarded against a savepoint, so an operation issued with pending changes and a savepoint set still fails.- Since:
- 4.2.0
-
setFlushAfterInMemoryBulkOperation
public void setFlushAfterInMemoryBulkOperation(boolean b) Whether a bulk update or delete that has to be executed in memory flushes the persistence context afterwards.- Since:
- 4.2.0
-
getMapAutoApplyConvertedFields
public boolean getMapAutoApplyConvertedFields()Whether an attribute without a mapping annotation of its own whose type is not serializable is mapped as a basic attribute when an auto-apply converter (@Converter(autoApply = true)) is registered for its type. Defaults to true, as Jakarta Persistence 3.2 section 3.9 requires: a converted attribute is a basic attribute, and an auto-apply converter applies to all attributes of its target type. The attribute is stored in a column of the converter's database type.Set to false to restore the OpenJPA 4.1.x mapping, in which such an attribute had no persistence strategy and was left out of the mapping with only a warning, so that its value was not stored. Attributes of a serializable type and attributes annotated with
@Basicare not affected by this option.The enhancer decides which fields of a class are persistent, so the option has to be set where the enhancer sees it as well, e.g. in
persistence.xml, and build-time enhanced classes have to be enhanced again after it changes. A class enhanced with the default keeps such an attribute persistent when the option is set to false at runtime only.- Since:
- 4.2.0
-
setMapAutoApplyConvertedFields
public void setMapAutoApplyConvertedFields(boolean b) Whether an attribute whose type is not serializable is mapped as a basic attribute when an auto-apply converter is registered for its type.- Since:
- 4.2.0
-
getEmulateNativeSequences
public boolean getEmulateNativeSequences()Whether a named generator that asks for a database sequence is backed by a table sequence when the database has no sequence objects at all, i.e. when the dictionary defines noNextSequenceQuery. Defaults to true. Set to false to get the historical behaviour, where such a generator fails to configure with"Your database dictionary does not support native sequences".The substitution keys the emulated sequence by the sequence name, so entities sharing one generator share one counter, and
initialValueandallocationSizeare honoured either way. It changes which object holds the identifier state, however: a schema built by an earlier OpenJPA release does not have the sequence table, and an application that generated identifiers elsewhere - a sequence created by hand plus an explicitNextSequenceQuery, for instance - should configure that query rather than rely on the fallback.- Since:
- 4.2.0
-
setEmulateNativeSequences
public void setEmulateNativeSequences(boolean b) Whether a named generator that asks for a database sequence is backed by a table sequence when the database has no sequence objects at all.- Since:
- 4.2.0
-
getResolveConverterTypeHierarchy
public boolean getResolveConverterTypeHierarchy()Whether the type arguments of anAttributeConverter<X, Y>are resolved through the whole type hierarchy of the converter class. Defaults to true: a converter that gets its attribute typeXor its database typeYfrom a generic superclass, such asBase<X, Y> implements AttributeConverter<X, Y>, or from an interface that extendsAttributeConvertermaps its attribute to a column of the database type, and such a converter, like one whose attribute type is parameterized, is registered when it is declaredautoApply.Set to false to restore the OpenJPA 4.1.x mapping for attributes whose converter declares its types through a generic superclass or interface: only a class in the superclass chain of the converter that implements
AttributeConverterdirectly with concrete type arguments is considered, so such a serializable attribute is mapped as a serialized object (a BLOB, BYTEA on PostgreSQL) as in 4.1.x, and anautoApplyconverter of that kind or of a parameterized attribute type is not applied, as 4.1.x ignoredautoApply. Converters that implementAttributeConverterdirectly with concrete type arguments are not affected by this option.- Since:
- 4.2.0
-
setResolveConverterTypeHierarchy
public void setResolveConverterTypeHierarchy(boolean b) Whether the type arguments of anAttributeConverterare resolved through the whole type hierarchy of the converter class.- Since:
- 4.2.0
-
getUpdatedReservedWords
public boolean getUpdatedReservedWords()Whether the dictionaries use the reserved words of the current database versions that were added in 4.2.0, and the naming that comes with them. Defaults to true. Set to false to keep the table and column names an earlier release generated, e.g. for a schema that is still used under its original names. Which words and names are affected is described by the dictionaries that honour this option, currentlyMySQLDictionaryandMariaDBDictionary.- Since:
- 4.2.0
-
setUpdatedReservedWords
public void setUpdatedReservedWords(boolean b) Whether the dictionaries use the reserved words of the current database versions that were added in 4.2.0.- Since:
- 4.2.0
-