Class Compatibility

java.lang.Object
org.apache.openjpa.conf.Compatibility

public class Compatibility extends Object
Struct encompassing backwards-compatibility options.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Allow non-compliant extensions of JPQL.
    static final int
    If a JPQL statement is not compliant with the JPA specification, fail to parse it.
    static final int
    If a JPQL statement is not compliant with the JPA specification, warn the first time that statement is parsed.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Whether CriteriaBuilder.tuple() and CriteriaBuilder.array() accept compound selections as arguments.
    boolean
    Whether to turn collection/map tracing off in case of more number of modifications.
    boolean
    Whether the SQL generated for queries executed with a modified fetch plan are cached.
    boolean
    Whether openjpa will always cascade on detach, regardless of the cascade setting.
    boolean
    Whether OpenJPA will check the database for an Entity when cascading a persist to another Entity.
    boolean
    Whether a bulk delete removes the rows of the join tables and element collection tables owned by the deleted entities.
    boolean
    Whether to close the broker when the managed transaction commits.
    boolean
     
    boolean
    Whether to copy identity objects before returning them to client code.
    boolean
    Affirms if detached entities are copy of the managed instances.
    boolean
    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.
    boolean
    Whether the metadata processor should filter classes dispatched by the PCRegistry listener system.
    boolean
    Whether a bulk update or delete that has to be executed in memory flushes the persistence context afterwards.
    boolean
    Whether OpenJPA should flush changes before detaching or serializing an entity.
    boolean
    Whether OpenJPA should ignore the DetachedStateField value when determining if our Proxy classes should be removed during serialization.
    int
    Whether or not JPQL extensions are allowed.
    boolean
    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.
    boolean
    Whether Query.getResultList() copies the query result into a ArrayList.
    boolean
    Whether the MetaDataFactory and MappingFactory should be set to strict mode.
    boolean
    Whether or not to perform a version check on instances being updated in a datastore transaction.
    boolean
    Whether to temporally override the thread's Context Classloader when processing ORM XML documents to avoid deadlock potential with certain Classloader hierarchy configurations.
    boolean
    Whether OpenJPA will scan every persistent class in an XML mapping file for annotations prior to executing a query.
    boolean
    Whether OpenJPA allows private, non-transient properties to be persistent.
    boolean
    Whether to interpret quoted numbers in query strings as numbers.
    boolean
    Whether OpenJPA should attempt to load fields when the DetachState option is set to loaded.
    boolean
    Whether OpenJPA should reset the internal state (flush flag) when cascading a persist to another Entity.
    boolean
    Whether the type arguments of an AttributeConverter<X, Y> are resolved through the whole type hierarchy of the converter class.
    boolean
    This property is used to specify whether the aggregate query functions SUM, AVG, MAX, and MIN return null if there is no query result.
    boolean
    Whether to enable JPA spec-compliant schema generation behavior.
    boolean
    Whether if map and collection in entity are stored as blob.
    boolean
    Whether to require exact identity value types when creating object ids from a class and value.
    boolean
    Whether to add class criteria for super class discreminator strategy.
    boolean
    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.
    boolean
    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".
    boolean
    This property can be used to allow OpenJPA to use ListAttributes for all types of Arrays, not just those with the @ PersistentCollection annotation.
    boolean
    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).
    boolean
    Whether to return hollow instances to broker lookups with a validate parameter of false.
    boolean
    Whether to check the datastore for the existence of a nontransactional cached object in broker lookups with a validate parameter of true.
    boolean
    Whether OpenJPA allows bi-directional relationship in the MappedSuperclass.
    boolean
    Whether OpenJPA allows non-default entity relationship mapping.
    boolean
    Returns true if life cycle event manager is a singleton configuration.
    void
    setAbstractMappingUniDirectional(boolean isAbstractMappingUniDirectional)
    Whether OpenJPA allows bi-directional relationship in the MappedSuperclass.
    void
    Whether CriteriaBuilder.tuple() and CriteriaBuilder.array() accept compound selections as arguments.
    void
    setAutoOff(boolean autoOff)
    Whether to turn collection/map tracing off in case of more number of modifications.
    void
    Whether the SQL generated for queries executed with a modified fetch plan are cached.
    void
    setCascadeWithDetach(boolean cascadeWithDetach)
    Whether openjpa should always cascade on detach, regardless of the cascade setting.
    void
    Whether OpenJPA will check the database for an Entity when cascading a persist to another Entity.
    void
    Whether a bulk delete removes the rows of the join tables and element collection tables owned by the deleted entities.
    void
    setCloseOnManagedCommit(boolean close)
    Whether to close the broker when the managed transaction commits.
    void
     
    void
    setCopyObjectIds(boolean copy)
    Whether to copy identity objects before returning them to client code.
    void
    setCopyOnDetach(boolean copyOnDetach)
    Sets if detached entities are copy of the managed instances.
    void
    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.
    void
    Whether the metadata processor should filter classes dispatched by the PCRegistry listener system.
    void
    Whether a bulk update or delete that has to be executed in memory flushes the persistence context afterwards.
    void
    setFlushBeforeDetach(boolean beforeDetach)
    Whether OpenJPA should flush changes before detaching or serializing an entity.
    void
    Whether OpenJPA should ignore the DetachedStateField value when determining if our Proxy classes should be removed during serialization.
    void
    Whether or not JPQL extensions are allowed.
    void
    Whether an attribute whose type is not serializable is mapped as a basic attribute when an auto-apply converter is registered for its type.
    void
    Whether Query.getResultList() copies the query result into a ArrayList.
    void
    setMetaFactoriesAreStrict(boolean metaFactoriesAreStrict)
    Set whether MetaDataFactories and MappingFactories will be strictly separate.
    void
    setNonDefaultMappingAllowed(boolean isNonDefaultMappingAllowed)
    Whether OpenJPA allows non-default entity relationship mapping.
    void
    setNonOptimisticVersionCheck(boolean nonOptimisticVersionCheck)
    Whether or not to perform a version check on instances being updated in a datastore transaction.
    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.
    void
    setParseAnnotationsForQueryMode(boolean parseAnnotationsForQueryMode)
    Whether OpenJPA will scan every persistent class in an XML mapping file for annotations prior to executing a query.
    void
    setPrivatePersistentProperties(boolean privateProps)
    Whether OpenJPA allows private, non-transient properties to be persistent.
    void
    setQuotedNumbersInQueries(boolean quotedNumbers)
    Whether to interpret quoted numbers in query strings as numbers.
    void
    setReloadOnDetach(boolean reloadOnDetach)
    Whether OpenJPA should attempt to load fields when the DetachState option is set to loaded.
    void
    Whether OpenJPA should reset the internal state (flush flag) when cascading a persist to another Entity.
    void
    Whether the type arguments of an AttributeConverter are resolved through the whole type hierarchy of the converter class.
    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.
    void
    This property set whether each EntityManager has its own life cycle event manager.
    void
    Whether to enable JPA spec-compliant schema generation behavior.
    void
    Whether if map and collection in entity are stored as blob.
    void
    setStrictIdentityValues(boolean strictVals)
    Whether to require exact identity value types when creating object ids from a class and value.
    void
    setSuperclassDiscriminatorStrategyByDefault(boolean superclassDiscriminatorStrategyByDefault)
    Whether to add class criteria for super class discreminator strategy.
    void
    Whether the dictionaries use the reserved words of the current database versions that were added in 4.2.0.
    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".
    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.
    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).
    void
    Whether to return hollow instances to broker lookups with a validate parameter of false.
    void
    Whether to check the datastore for the existence of a nontransactional cached object in broker lookups with a validate parameter of true.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • JPQL_STRICT

      public static final int JPQL_STRICT
      If 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_WARN
      If 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_EXTENDED
      Allow 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 a validate parameter of false. OpenJPA versions prior to 0.4.0 did not return hollow instances without special configuration (the ObjectLookupMode). 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 a validate parameter of false. OpenJPA versions prior to 0.4.0 did not return hollow instances without special configuration (the ObjectLookupMode). 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 a validate parameter 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 a validate parameter 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 to JPQL_STRICT.
      Since:
      1.1.0
      See Also:
    • setJPQL

      public void setJPQL(String jpql)
      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 to false.
      Since:
      1.1.0
    • setStoreMapCollectionInEntityAsBlob

      public void setStoreMapCollectionInEntityAsBlob(boolean storeAsBlob)
      Whether if map and collection in entity are stored as blob. Defaults to false.
      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 explicit database.action=drop via Persistence.generateSchema() will suppress a subsequent SynchronizeMappings=buildSchema from 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()
      Whether Query.getResultList() copies the query result into a ArrayList. 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 the EntityManager has been closed. When false, the lazy org.apache.openjpa.lib.rop.ResultList of releases before 4.2.0 is returned, which streams rows on demand according to openjpa.FetchBatchSize and becomes invalid on close.
      Since:
      4.2.0
    • setMaterializeQueryResultList

      public void setMaterializeQueryResultList(boolean b)
      Whether Query.getResultList() copies the query result into a ArrayList. Set to false to restore the lazy, streaming result list of releases before 4.2.0.
      Since:
      4.2.0
    • getAllowNestedCompoundSelection

      public boolean getAllowNestedCompoundSelection()
      Whether CriteriaBuilder.tuple() and CriteriaBuilder.array() accept compound selections as arguments. The specification forbids nesting a compound selection in another one, which OpenJPA rejects with an IllegalArgumentException by 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)
      Whether CriteriaBuilder.tuple() and CriteriaBuilder.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 flush executeUpdate() 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: @PostRemove and @PostUpdate (AFTER_DELETE_PERFORMED and AFTER_UPDATE_PERFORMED) fire during a flush, so they run inside executeUpdate() 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_FLUSH is not supported or a savepoint is set that the configured SavepointManager cannot 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 @Basic are 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 no NextSequenceQuery. 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 initialValue and allocationSize are 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 explicit NextSequenceQuery, 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 an AttributeConverter<X, Y> are resolved through the whole type hierarchy of the converter class. Defaults to true: a converter that gets its attribute type X or its database type Y from a generic superclass, such as Base<X, Y> implements AttributeConverter<X, Y>, or from an interface that extends AttributeConverter maps 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 declared autoApply.

      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 AttributeConverter directly 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 an autoApply converter of that kind or of a parameterized attribute type is not applied, as 4.1.x ignored autoApply. Converters that implement AttributeConverter directly 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 an AttributeConverter are 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, currently MySQLDictionary and MariaDBDictionary.
      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