org.apache.openjpa.conf
Class Compatibility

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

public class Compatibility
extends Object

Struct encompassing backwards-compatibility options.


Field Summary
static int JPQL_EXTENDED
          Allow non-compliant extensions of JPQL.
static int JPQL_STRICT
          If a JPQL statement is not compliant with the JPA specification, fail to parse it.
static int JPQL_WARN
          If a JPQL statement is not compliant with the JPA specification, warn the first time that statement is parsed.
 
Constructor Summary
Compatibility()
           
 
Method Summary
 boolean getAutoOff()
          Whether to turn collection/map tracing off in case of more number of modifications.
 boolean getCascadeWithDetach()
          Whether openjpa will always cascade on detach, regardless of the cascade setting.
 boolean getCheckDatabaseForCascadePersistToDetachedEntity()
          Whether OpenJPA will check the database for an Entity when cascading a persist to another Entity.
 boolean getCloseOnManagedCommit()
          Whether to close the broker when the managed transaction commits.
 boolean getConvertPositionalParametersToNamed()
           
 boolean getCopyObjectIds()
          Whether to copy identity objects before returning them to client code.
 boolean getCopyOnDetach()
          Affirms if detached entities are copy of the managed instances.
 boolean getFlushBeforeDetach()
          Whether OpenJPA should flush changes before detaching or serializing an entity.
 boolean getIgnoreDetachedStateFieldForProxySerialization()
          Whether OpenJPA should ignore the DetachedStateField value when determining if our Proxy classes should be removed during serialization.
 int getJPQL()
          Whether or not JPQL extensions are allowed.
 boolean getMetaFactoriesAreStrict()
          Whether the MetaDataFactory and MappingFactory should be set to strict mode.
 boolean getNonOptimisticVersionCheck()
          Whether or not to perform a version check on instances being updated in a datastore transaction.
 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.
 boolean getParseAnnotationsForQueryMode()
          Whether OpenJPA will scan every persistent class in an XML mapping file for annotations prior to executing a query.
 boolean getPrivatePersistentProperties()
          Whether OpenJPA allows private, non-transient properties to be persistent.
 boolean getQuotedNumbersInQueries()
          Whether to interpret quoted numbers in query strings as numbers.
 boolean getReloadOnDetach()
          Whether OpenJPA should attempt to load fields when the DetachState option is set to loaded.
 boolean getResetFlushFlagForCascadePersist()
          Whether OpenJPA should reset the internal state (flush flag) when cascading a persist to another Entity.
 boolean getStoreMapCollectionInEntityAsBlob()
          Whether if map and collection in entity are stored as blob.
 boolean getStrictIdentityValues()
          Whether to require exact identity value types when creating object ids from a class and value.
 boolean getSuperclassDiscriminatorStrategyByDefault()
          Whether to add class criteria for super class discreminator strategy.
 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".
 boolean getUseListAttributeForArrays()
          This property can be used to allow OpenJPA to use ListAttributes for all types of Arrays, not just those with the
 boolean getValidateFalseReturnsHollow()
          Whether to return hollow instances to broker lookups with a validate parameter of false.
 boolean getValidateTrueChecksStore()
          Whether to check the datastore for the existence of a nontransactional cached object in broker lookups with a validate parameter of true.
 boolean isAbstractMappingUniDirectional()
          Whether OpenJPA allows bi-directional relationship in the MappedSuperclass.
 boolean isNonDefaultMappingAllowed()
          Whether OpenJPA allows non-default entity relationship mapping.
 void setAbstractMappingUniDirectional(boolean isAbstractMappingUniDirectional)
          Whether OpenJPA allows bi-directional relationship in the MappedSuperclass.
 void setAutoOff(boolean autoOff)
          Whether to turn collection/map tracing off in case of more number of modifications.
 void setCascadeWithDetach(boolean cascadeWithDetach)
          Whether openjpa should always cascade on detach, regardless of the cascade setting.
 void setCheckDatabaseForCascadePersistToDetachedEntity(boolean b)
          Whether OpenJPA will check the database for an Entity when cascading a persist to another Entity.
 void setCloseOnManagedCommit(boolean close)
          Whether to close the broker when the managed transaction commits.
 void setConvertPositionalParametersToNamed(boolean c)
           
 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 setFlushBeforeDetach(boolean beforeDetach)
          Whether OpenJPA should flush changes before detaching or serializing an entity.
 void setIgnoreDetachedStateFieldForProxySerialization(boolean ignoreDSF)
          Whether OpenJPA should ignore the DetachedStateField value when determining if our Proxy classes should be removed during serialization.
 void setJPQL(String jpql)
          Whether or not JPQL extensions are allowed.
 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 setResetFlushFlagForCascadePersist(boolean b)
          Whether OpenJPA should reset the internal state (flush flag) when cascading a persist to another Entity.
 void setStoreMapCollectionInEntityAsBlob(boolean storeAsBlob)
          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 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
 void setValidateFalseReturnsHollow(boolean hollow)
          Whether to return hollow instances to broker lookups with a validate parameter of false.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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:
Constant Field Values

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:
Constant Field Values

JPQL_EXTENDED

public static final int JPQL_EXTENDED
Allow non-compliant extensions of JPQL.

Since:
1.1.0
See Also:
Constant Field Values
Constructor Detail

Compatibility

public Compatibility()
Method Detail

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:
JPQL_WARN, JPQL_STRICT, JPQL_EXTENDED

setJPQL

public void setJPQL(String jpql)
Whether or not JPQL extensions are allowed. Possible values: "warn", "strict", "extended".

Since:
1.1.0
See Also:
JPQL_WARN, JPQL_STRICT, JPQL_EXTENDED

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:
useJPA2 - true if the JPA 2.0 default name should be used. false if the 1.x name should be used.
Since:
2.0.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

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

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


Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.