5. OpenJPA Properties
Prev | Chapter 2. Configuration | Next

## 5. OpenJPA Properties

OpenJPA defines many configuration properties. Most of these properties are provided for advanced users who wish to customize OpenJPA's behavior; the majority of developers can omit them. The following properties apply to any OpenJPA back-end, though the given descriptions are tailored to OpenJPA's default JDBC store.

A few of the properties recognized by OpenJPA have been standardized in JPA 2.0 specification using equivalent names. These properties can be specified either by the JPA standard key or equivalent OpenJPA key. Specifying the same key once as JPA standard key and again as equivalent OpenJPA key in the same configuration, however, is not allowed. The following table lists these standard JPA properties and their OpenJPA equivalent.

Table 2.1. Standard JPA Properties and OpenJPA equivalents

Standard JPA 2.0 | OpenJPA Equivalent
--- | ---
jakarta.persistence.jdbc.driver | openjpa.ConnectionDriverName
jakarta.persistence.jdbc.url | openjpa.ConnectionURL
jakarta.persistence.jdbc.user | openjpa.ConnectionUserName
jakarta.persistence.jdbc.password | openjpa.ConnectionPassword

### 5.1. openjpa.AutoClear

Property name: `openjpa.AutoClear`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getAutoClear`

Resource adaptor config-property: `AutoClear`

Default: `datastore`

Possible values: `datastore`, `all`

Description: When to automatically clear instance state: on entering a datastore transaction, or on entering any transaction.

### 5.2. openjpa.AutoDetach

Property name: `openjpa.AutoDetach`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getAutoDetach`

Resource adaptor config-property: `AutoDetach`

Default: - null

Possible values: `close`, `commit`, `nontx-read`, `rollback`, `none`

Description: A comma-separated list of events when managed instances will be automatically detached. When using the OpenJPA EntityManager this defaults to `close`, and `rollback` per the JPA spec. If you need to change this setting, you need to set it directly on an instantiated EntityManager.

`none` option is exclusive. It can not be specified with any other option. `none` option implies that managed objects will not be detached from the persistence context, the second-class object fields such as collections or date will not be proxied unlike normal circumstances. This option is relevant for specific use cases where the user application would not refer to the managed objects after the transaction and/or the context ends e.g. typical batch insertion scenario.

### 5.3. openjpa.BrokerFactory

Property name: `openjpa.BrokerFactory`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getBrokerFactory`

Resource adaptor config-property: `BrokerFactory`

Default: `jdbc`

Possible values: `jdbc`, `abstractstore`, `remote`

Description: A plugin string (see Section 4, “ Plugin Configuration ”) describing the `org.apache.openjpa.kernel.BrokerFactory` type to use.

### 5.4. openjpa.BrokerImpl

Property name: `openjpa.BrokerImpl`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getBrokerImpl`

Resource adaptor config-property: `BrokerImpl`

Default: `default`

Description: A plugin string (see Section 4, “ Plugin Configuration ”) describing the `org.apache.openjpa.kernel.Broker` type to use at runtime. See Section 1.2, “ Broker Customization and Eviction ” on for details.

### 5.5. openjpa.Callbacks

Property name: `openjpa.Callbacks`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getCallbackOptionsInstance`

Resource adaptor config-property: `Callbacks`

Default: `default`

Description: A plugin string (see Section 4, “ Plugin Configuration ”) to fine tune some of the configurable properties related to callbacks. The plug-in supports two boolean properties:

- `PostPersistCallbackImmediate`: whether the post-persist callback is invoked as soon as a new instance is managed. The default is `false`, implies that the post-persist callback is invoked after the instance been committed or flushed to the datastore.

- `AllowsMultipleMethodsForSameCallback`: whether multiple methods of the same class can handle the same callback event. Defaults to `false`.

### 5.6. openjpa.ClassResolver

Property name: `openjpa.ClassResolver`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getClassResolver`

Resource adaptor config-property: `ClassResolver`

Default: `default`

Description: A plugin string (see Section 4, “ Plugin Configuration ”) describing the `org.apache.openjpa.util.ClassResolver` implementation to use for class name resolution. You may wish to plug in your own resolver if you have special classloading needs.

### 5.7. openjpa.Compatibility

Property name: `openjpa.Compatibility`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getCompatibility`

Resource adaptor config-property: `Compatibility`

Default: -

Description: Encapsulates options to mimic the behavior of previous OpenJPA releases.

### 5.8. openjpa.ConnectionDriverName

Property name: `openjpa.ConnectionDriverName`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getConnectionDriverName`

Resource adaptor config-property: `ConnectionDriverName`

Default: -

Description: The full class name of either the JDBC `java.sql.Driver`, or a `javax.sql.DataSource` implementation to use to connect to the database. See Chapter 4, JDBC for details.

### 5.9. openjpa.Connection2DriverName

Property name: `openjpa.Connection2DriverName`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getConnection2DriverName`

Resource adaptor config-property: `Connection2DriverName`

Default: -

Description: This property is equivalent to the `openjpa.ConnectionDriverName` property described in Section 5.8, “ openjpa.ConnectionDriverName ”, but applies to the alternate connection factory used for unmanaged connections. See Section 2.1, “ Managed and XA DataSources ” for details.

### 5.10. openjpa.ConnectionFactory

Property name: `openjpa.ConnectionFactory`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getConnectionFactory`

Resource adaptor config-property: `ConnectionFactory`

Default: -

Description: A `javax.sql.DataSource` to use to connect to the database. See Chapter 4, JDBC for details.

### 5.11. openjpa.ConnectionFactory2

Property name: `openjpa.ConnectionFactory2`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getConnectionFactory2`

Resource adaptor config-property: `ConnectionFactory2`

Default: -

Description: An unmanaged `javax.sql.DataSource` to use to connect to the database. See Chapter 4, JDBC for details.

### 5.12. openjpa.ConnectionFactoryName

Property name: `openjpa.ConnectionFactoryName`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getConnectionFactoryName`

Resource adaptor config-property: `ConnectionFactoryName`

Default: -

Description: The JNDI location of a `javax.sql.DataSource` to use to connect to the database. See Chapter 4, JDBC for details.

### 5.13. openjpa.ConnectionFactory2Name

Property name: `openjpa.ConnectionFactory2Name`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getConnectionFactory2Name`

Resource adaptor config-property: `ConnectionFactory2Name`

Default: -

Description: The JNDI location of an unmanaged `javax.sql.DataSource` to use to connect to the database. See Section 3, “ XA Transactions ” for details.

### 5.14. openjpa.ConnectionFactoryMode

Property name: `openjpa.ConnectionFactoryMode`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getConnectionFactoryMode`

Resource adaptor config-property: `ConnectionFactoryMode`

Default: `local`

Possible values: `local`, `managed`

Description: The connection factory mode to use when integrating with the application server's managed transactions. See Section 2.1, “ Managed and XA DataSources ” for details.

### 5.15. openjpa.ConnectionFactoryProperties

Property name: `openjpa.ConnectionFactoryProperties`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getConnectionFactoryProperties`

Resource adaptor config-property: `ConnectionFactoryProperties`

Default: -

Description: A plugin string (see Section 4, “ Plugin Configuration ”) listing properties for configuration of the datasource in use. See the Chapter 4, JDBC for details.

### 5.16. openjpa.ConnectionFactory2Properties

Property name: `openjpa.ConnectionFactory2Properties`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getConnectionFactory2Properties`

Resource adaptor config-property: `ConnectionFactory2Properties`

Default: -

Description: This property is equivalent to the `openjpa.ConnectionFactoryProperties` property described in Section 5.15, “ openjpa.ConnectionFactoryProperties ”, but applies to the alternate connection factory used for unmanaged connections. See Section 2.1, “ Managed and XA DataSources ” for details.

### 5.17. openjpa.ConnectionPassword

Property name: `openjpa.ConnectionPassword`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getConnectionPassword`

Resource adaptor config-property: `ConnectionPassword`

Default: -

Description: The password for the user specified in the `ConnectionUserName` property. See Chapter 4, JDBC for details.

### 5.18. openjpa.Connection2Password

Property name: `openjpa.Connection2Password`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getConnection2Password`

Resource adaptor config-property: `Connection2Password`

Default: -

Description: This property is equivalent to the `openjpa.ConnectionPassword` property described in Section 5.17, “ openjpa.ConnectionPassword ”, but applies to the alternate connection factory used for unmanaged connections. See Section 2.1, “ Managed and XA DataSources ” for details.

### 5.19. openjpa.ConnectionProperties

Property name: `openjpa.ConnectionProperties`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getConnectionProperties`

Resource adaptor config-property: `ConnectionProperties`

Default: -

Description: A plugin string (see Section 4, “ Plugin Configuration ”) listing properties to configure the driver listed in the `ConnectionDriverName` property described below. See Chapter 4, JDBC for details.

### 5.20. openjpa.Connection2Properties

Property name: `openjpa.Connection2Properties`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getConnection2Properties`

Resource adaptor config-property: `Connection2Properties`

Default: -

Description: This property is equivalent to the `openjpa.ConnectionProperties` property described in Section 5.19, “ openjpa.ConnectionProperties ”, but applies to the alternate connection factory used for unmanaged connections. See Section 2.1, “ Managed and XA DataSources ” for details.

### 5.21. openjpa.ConnectionURL

Property name: `openjpa.ConnectionURL`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getConnectionURL`

Resource adaptor config-property: `ConnectionURL`

Default: -

Description: The JDBC URL for the database. See Chapter 4, JDBC for details.

### 5.22. openjpa.Connection2URL

Property name: `openjpa.Connection2URL`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getConnection2URL`

Resource adaptor config-property: `Connection2URL`

Default: -

Description: This property is equivalent to the `openjpa.ConnectionURL` property described in Section 5.21, “ openjpa.ConnectionURL ”, but applies to the alternate connection factory used for unmanaged connections. See Section 2.1, “ Managed and XA DataSources ” for details.

### 5.23. openjpa.ConnectionUserName

Property name: `openjpa.ConnectionUserName`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getConnectionUserName`

Resource adaptor config-property: `ConnectionUserName`

Default: -

Description: The user name to use when connecting to the database. See the Chapter 4, JDBC for details.

### 5.24. openjpa.Connection2UserName

Property name: `openjpa.Connection2UserName`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getConnection2UserName`

Resource adaptor config-property: `Connection2UserName`

Default: -

Description: This property is equivalent to the `openjpa.ConnectionUserName` property described in Section 5.23, “ openjpa.ConnectionUserName ”, but applies to the alternate connection factory used for unmanaged connections. See Section 2.1, “ Managed and XA DataSources ” for details.

### 5.25. openjpa.ConnectionRetainMode

Property name: `openjpa.ConnectionRetainMode`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getConnectionRetainMode`

Resource adaptor config-property: `ConnectionRetainMode`

Default: `on-demand`

Description: Controls how OpenJPA uses datastore connections. This property can also be specified for individual sessions. See Section 8, “ Configuring the Use of JDBC Connections ” for details.

### 5.26. openjpa.DataCache

Property name: `openjpa.DataCache`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getDataCache`

Resource adaptor config-property: `DataCache`

Default: `false`

Description: A plugin list string (see Section 4, “ Plugin Configuration ”) describing the `org.apache.openjpa.datacache.DataCache`s to use for data caching. See Section 1.1, “ Data Cache Configuration ” for details.

### 5.27. openjpa.DataCacheManager

Property name: `openjpa.DataCacheManager`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getDataCacheManager`

Resource adaptor config-property: `DataCacheManager`

Default: `default`

Description: A plugin string (see Section 4, “ Plugin Configuration ”) describing the `openjpa.datacache.DataCacheManager` that manages the system data caches. See Section 1, “ Data Cache ” for details on data caching.

### 5.28. openjpa.DataCacheMode

Property name: `openjpa.DataCacheMode`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getDataCacheMode`

Resource adaptor config-property: `DataCacheMode`

Default: `DataCacheMode.UNSPECIFIED (see javadoc for details)`

Description:Determines which entities will be included in the DataCache. May be any of the values defined in ../../apidocs/org/apache/openjpa/datacache/DataCacheMode.html.

### 5.29. openjpa.DataCacheTimeout

Property name: `openjpa.DataCacheTimeout`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getDataCacheTimeout`

Resource adaptor config-property: `DataCacheTimeout`

Default: `-1`

Description: The number of milliseconds that data in the data cache is valid. Set this to -1 to indicate that data should not expire from the cache. This property can also be specified for individual classes. See Section 1.1, “ Data Cache Configuration ” for details.

### 5.30. openjpa.DetachState

Property name: `openjpa.DetachState`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfigurationImpl.getDetachState`

Resource adaptor config-property: `DetachState`

Default: `loaded`

Possible values: `loaded`, `fetch-groups`, `all`

Description: Determines which fields are part of the detached graph and related options. For more details, see Section 1.3, “ Defining the Detached Object Graph ”.

### 5.31. openjpa.DynamicDataStructs

Property name: `openjpa.DynamicDataStructs`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getDynamicDataStructs`

Resource adaptor config-property: `DynamicDataStructs`

Default: `false`

Description: Whether to dynamically generate customized structs to hold persistent data. Both the OpenJPA data cache and the remote framework rely on data structs to cache and transfer persistent state. With dynamic structs, OpenJPA can customize data storage for each class, eliminating the need to generate primitive wrapper objects. This saves memory and speeds up certain runtime operations. The price is a longer warm-up time for the application - generating and loading custom classes into the JVM takes time. Therefore, only set this property to `true` if you have a long-running application where the initial cost of class generation is offset by memory and speed optimization over time.

### 5.32. openjpa.DynamicEnhancementAgent

Property name: `openjpa.DynamicEnhancementAgent`

Configuration API: org.apache.openjpa.conf.OpenJPAConfiguration.getDynamicEnhancementAgent

Resource adaptor config property: DynamicEnhancementAgent

Default: `true`

Description: The DynamicEnhancementAgent property controls whether or not OpenJPA will attempt to dynamically load the PCEnhancer javaagent.

See the reference guide for more information Section 2.4, “ Enhancing Dynamically at Runtime ”

### 5.33. openjpa.FetchBatchSize

Property name: `openjpa.FetchBatchSize`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getFetchBatchSize`

Resource adaptor config-property: `FetchBatchSize`

Default: `-1`

Description: The number of rows to fetch at once when scrolling through a result set. The fetch size can also be set at runtime. See Section 10, “ Large Result Sets ” for details.

### 5.34. openjpa.EncryptionProvider

Property name: `openjpa.EncryptionProvider`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getEncryptionProvider`

Resource adaptor config-property: `EncryptionProvider`

Default: `false`

Description: A plugin list string (see Section 4, “ Plugin Configuration ”) describing the `org.apache.openjpa.lib.encryption.EncryptionProvider`s to use for connection password encryption. See Chapter 11, Encryption Provider for details.

### 5.35. openjpa.FetchGroups

Property name: `openjpa.FetchGroups`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getFetchGroups`

Resource adaptor config-property: `FetchGroups`

Default: -

Description: A comma-separated list of fetch group names that are to be loaded when retrieving objects from the datastore. Fetch groups can also be set at runtime. See Section 7, “ Fetch Groups ” for details.

### 5.36. openjpa.FlushBeforeQueries

Property name: `openjpa.FlushBeforeQueries`

Property name: `openjpa.FlushBeforeQueries`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getFlushBeforeQueries`

Resource adaptor config-property: `FlushBeforeQueries`

Default: `true`

Description: Whether or not to flush any changes made in the current transaction to the datastore before executing a query. See Section 8, “ Configuring the Use of JDBC Connections ” for details.

### 5.37. openjpa.IgnoreChanges

Property name: `openjpa.IgnoreChanges`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getIgnoreChanges`

Resource adaptor config-property: `IgnoreChanges`

Default: `false`

Description: Whether to consider modifications to persistent objects made in the current transaction when evaluating queries. Setting this to `true` allows OpenJPA to ignore changes and execute the query directly against the datastore. A value of `false` forces OpenJPA to consider whether the changes in the current transaction affect the query, and if so to either evaluate the query in-memory or flush before running it against the datastore.

### 5.38. openjpa.Id

Property name: `openjpa.Id`

Resource adaptor config-property: `Id`

Default: none

Description: An environment-specific identifier for this configuration. This might correspond to a JPA persistence-unit name, or to some other more-unique value available in the current environment.

### 5.39. openjpa.InitializeEagerly

Property name: `openjpa.InitializeEagerly`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.isInitializeEagerly`

Resource adaptor config-property: `InitializeEagerly`

Default: `false`

Possible values: `false`, `true`

Description: Controls whether initialization is eager or lazy. Eager initialization imply all persistent classes, their mapping information, database connectivity and all other resources specified in the configuration of a persistence unit will be initialized when a persistent unit is constructed. The default behavior is lazy i.e. persistent classes, database and other resources are initialized only when the application refers to a resource for the first time.

### 5.40. openjpa.Instrumentation

Property name: `openjpa.Instrumentation`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getInstrumentation`

Resource adaptor config-property: `Instrumentation`

Default: `-`

Possible values: `jmx`, `custom plugin string`

Description: A plugin string (see Section 4, “ Plugin Configuration ”) describing one or more instances of `org.apache.openjpa.lib.instrumentation.InstrumentationProvider` and specific instruments to enable. See Chapter 16, Instrumentation for details.

### 5.41. openjpa.InverseManager

Property name: `openjpa.InverseManager`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getInverseManager`

Resource adaptor config-property: `InverseManager`

Default: `false`

Possible values: `false`, `true`

Description: A plugin string (see Section 4, “ Plugin Configuration ”) describing a `org.apache.openjpa.kernel.InverseManager` to use for managing bidirectional relations upon a flush. See Section 5, “ Managed Inverses ” for usage documentation.

### 5.42. openjpa.LockManager

Property name: `openjpa.LockManager`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getLockManager`

Resource adaptor config-property: `LockManager`

Default: `mixed`

Possible values: `none`, `version`, `pessimistic`, `mixed`

Description: A plugin string (see Section 4, “ Plugin Configuration ”) describing a `org.apache.openjpa.kernel.LockManager` to use for acquiring locks on persistent instances during transactions. See Section 3.4, “ Lock Manager ” for more information.

### 5.43. openjpa.LockTimeout

Property name: `openjpa.LockTimeout`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getLockTimeout`

Resource adaptor config-property: `LockTimeout`

Default: `-1`

Description: The number of milliseconds to wait for an object lock before throwing an exception, or -1 for no limit. See Section 3, “ Object Locking ” for details.

### 5.44. openjpa.Log

Property name: `openjpa.Log`

Configuration API: `org.apache.openjpa.lib.conf.Configuration.getLog`

Resource adaptor config-property: `Log`

Default: `true`

Possible values: `openjpa`, `commons`, `log4j`, `slf4j`, `none`

Description: A plugin string (see Section 4, “ Plugin Configuration ”) describing a `org.apache.openjpa.lib.log.LogFactory` to use for logging. For details on logging, see Chapter 3, Logging and Auditing .

### 5.45. openjpa.ManagedRuntime

Property name: `openjpa.ManagedRuntime`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getManagedRuntime`

Resource adaptor config-property: `ManagedRuntime`

Default: `auto`

Description: A plugin string (see Section 4, “ Plugin Configuration ”) describing the `org.apache.openjpa.ee.ManagedRuntime` implementation to use for obtaining a reference to the `TransactionManager` in an enterprise environment.

### 5.46. openjpa.Mapping

Property name: `openjpa.Mapping`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getMapping`

Resource adaptor config-property: `Mapping`

Default: -

Description: The symbolic name of the object-to-datastore mapping to use.

### 5.47. openjpa.MaxFetchDepth

Property name: `openjpa.MaxFetchDepth`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getMaxFetchDepth`

Resource adaptor config-property: `MaxFetchDepth`

Default: `-1`

Description: The maximum depth of relations to traverse when eager fetching. Use -1 for no limit. Defaults to no limit. See Section 8, “ Eager Fetching ” for details on eager fetching.

### 5.48. openjpa.MetaDataFactory

Property name: `openjpa.MetaDataFactory`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getMetaDataFactory`

Resource adaptor config-property: `MetaDataFactory`

Default: `jpa`

Description: A plugin string (see Section 4, “ Plugin Configuration ”) describing the `openjpa.meta.MetaDataFactory` to use to store and retrieve metadata for your persistent classes. See Section 1, “ Metadata Factory ” for details.

### 5.49. openjpa.MetaDataRepository

Property name: `openjpa.MetaDataRepository`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getMetaDataRepository`

Resource adaptor config-property: `MetaDataRepository`

Default:none``

Description: A plugin string (see Section 4, “ Plugin Configuration ”) describing the `openjpa.meta.MetaDataRepository` to use to store and retrieve metadata for your persistent classes. See Section 2, “Metadata Repository” for details.

### 5.50. openjpa.Multithreaded

Property name: `openjpa.Multithreaded`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getMultithreaded`

Resource adaptor config-property: `Multithreaded`

Default: `false`

Description: Whether persistent instances and OpenJPA components other than the `EntityManagerFactory` will be accessed by multiple threads at once.

### 5.51. openjpa.Optimistic

Property name: `openjpa.Optimistic`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getOptimistic`

Resource adaptor config-property: `Optimistic`

Default: `true`

Description: Selects between optimistic and pessimistic (datastore) transactional modes.

### 5.52. openjpa.OptimizeIdCopy

Property name: `openjpa.OptimizeIdCopy`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getOptimizeIdCopy`

Resource adaptor config-property: `OptimizeIdCopy`

Default: `false`

Description: Attempt to optimize id class copy operations used internally by the provider during various ORM operations. This optimization is only applicable for entities using simple id classes (via @IdClass or XML equivalent) that do not have public setters, provide a public constructor with exact matching parameter types, and perform direct assignments to id class fields within the constructor. If these conditions are met, OpenJPA will use a public constructor during internal id copy operations instead of less optimal reflection. Optimization of id copy occurs during the enhancement phase. If the enhancer determines optimization cannot occur, it will fallback to the normal behavior. A side effect of enabling this property is that an id class constructor will be called by the provider during runtime operations. If there is logic in the constructor in addition to field initialization, (parameter verification, for example) that logic will also be executed during the operation, which could result in a change in runtime behavior.

### 5.53. openjpa.OrphanedKeyAction

Property name: `openjpa.OrphanedKeyAction`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getOrphanedKeyAction`

Resource adaptor config-property: `OrphanedKeyAction`

Default: `log`

Possible values: `log`, `exception`, `none`

Description: A plugin string (see Section 4, “ Plugin Configuration ”) describing a `org.apache.openjpa.event.OrphanedKeyAction` to invoke when OpenJPA discovers an orphaned datastore key. See Section 11, “ Orphaned Keys ” for details.

### 5.54. openjpa.NontransactionalRead

Property name: `openjpa.NontransactionalRead`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getNontransactionalRead`

Resource adaptor config-property: `NontransactionalRead`

Default: `true`

Description: Whether the OpenJPA runtime will allow you to read data outside of a transaction.

### 5.55. openjpa.NontransactionalWrite

Property name: `openjpa.NontransactionalWrite`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getNontransactionalWrite`

Resource adaptor config-property: `NontransactionalWrite`

Default: `true`

Description: Whether you can modify persistent objects and perform persistence operations outside of a transaction. Changes will take effect on the next transaction.

### 5.56. openjpa.ProxyManager

Property name: `openjpa.ProxyManager`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getProxyManager`

Resource adaptor config-property: `ProxyManager`

Default: `default`

Description: A plugin string (see Section 4, “ Plugin Configuration ”) describing a `org.apache.openjpa.util.ProxyManager` to use for proxying mutable second class objects. See Section 6.4.3, “ Custom Proxies ” for details.

### 5.57. openjpa.PostLoadOnMerge

Property name: `openjpa.PostLoadOnMerge`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getPostLoadOnMerge`

Resource adaptor config-property: `PostLoadOnMerge`

Default: `false`

Description: Whether the OpenJPA runtime will trigger a PostLoad lifecycle event for EntityManager#merge(). If you enable this option, OpenJPA will also ensure that the whole entity from the database will get passed to the PostLoad entity listener.

### 5.58. openjpa.QueryCache

Property name: `openjpa.QueryCache`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getQueryCache`

Resource adaptor config-property: `QueryCache`

Default: `false`

Description: A plugin string (see Section 4, “ Plugin Configuration ”) describing the `org.apache.openjpa.datacache.QueryCache` implementation to use for caching of queries loaded from the data store. See Section 1.4, “ Query Cache ” for details.

### 5.59. openjpa.QueryCompilationCache

Property name: `openjpa.QueryCompilationCache`

Resource adaptor config-property: `QueryCompilationCache`

Default: `true`.

Description: A plugin string (see Section 4, “ Plugin Configuration ”) describing the `java.util.Map` to use for caching of data used during query compilation. See Section 2, “ Query Compilation Cache ” for details.

### 5.60. openjpa.ReadLockLevel

Property name: `openjpa.ReadLockLevel`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getReadLockLevel`

Resource adaptor config-property: `ReadLockLevel`

Default: `read`

Possible values: `none`, `read`, `write`, `optimistic`, `optimistic-force-increment`, `pessimistic-read`, `pessimistic-write`, `pessimistic-force-increment`, numeric values for lock-manager specific lock levels

Description: The default level at which to lock objects retrieved during a non-optimistic transaction. Note that for the default JDBC lock manager, `read` and `write` lock levels are equivalent. Lock levels `pessimistic-read`, `pessimistic-write` and `pessimistic-force-increment` are in effect only when the `mixed` lock manager is used.

### 5.61. openjpa.RemoteCommitProvider

Property name: `openjpa.RemoteCommitProvider`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getRemoteCommitProvider`

Resource adaptor config-property: `RemoteCommitProvider`

Default: - If `openjpa.DataCache` is enabled, the default value is `sjvm`.

Description: A plugin string (see Section 4, “ Plugin Configuration ”) describing the `org.apache.openjpa.event.RemoteCommitProvider` implementation to use for distributed event notification. See Section 2.1, “ Remote Commit Provider Configuration ” for more information.

### 5.62. openjpa.RestoreState

Property name: `openjpa.RestoreState`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getRestoreState`

Resource adaptor config-property: `RestoreState`

Default: `none`

Possible values: `none`, `immutable`, `all`

Description: Whether to restore managed fields to their pre-transaction values when a rollback occurs.

### 5.63. openjpa.RetainState

Property name: `openjpa.RetainState`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getRetainState`

Resource adaptor config-property: `RetainState`

Default: `true`

Description: Whether persistent fields retain their values on transaction commit.

### 5.64. openjpa.RetryClassRegistration

Property name: `openjpa.RetryClassRegistration`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getRetryClassRegistration`

Resource adaptor config-property: `RetryClassRegistration`

Default: `false`

Description: Controls whether to log a warning and defer registration instead of throwing an exception when a persistent class cannot be fully processed. This property should only be used in complex classloader situations where security is preventing OpenJPA from reading registered classes. Setting this to true unnecessarily may obscure more serious problems.

### 5.65. openjpa.RuntimeUnenhancedClasses

Property name: `openjpa.RuntimeUnenhancedClasses`

Configuration API: org.apache.openjpa.conf.OpenJPAConfiguration.getRuntimeUnenhancedClasses

Resource adaptor config property: RuntimeUnenhancedClasses

Default: `unsupported`

Possible values: `supported`, `unsupported`, `warn`

Description: The RuntimeUnenhancedClasses property controls how OpenJPA handles classes that have not been enhanced by the PCEnhancer tool or automatically by a javaagent. If RuntimeUnenhancedClasses is set to `supported` OpenJPA will automatically create subclasses for unenhanced entity classes. If set to `unsupported` OpenJPA will not create subclasses for unenhanced entity classes and will throw an exception when they are detected. If set to `warn` OpenJPA will not create subclasses for unenhanced entity classes but will log a warning message.

This function is often useful for rapid prototyping but is not generally recommended for use in production. Please consult the reference guide before changing the default value.

See the reference guide section on unenhanced types for more information Section 2.5, “ Omitting the OpenJPA enhancer ”

### 5.66. openjpa.SavepointManager

Property name: `openjpa.SavepointManager`

Configuration API: org.apache.openjpa.conf.OpenJPAConfiguration.getSavepointManager

Resource adaptor config-property: SavepointManager

Default: `in-mem`

Possible values: `in-mem`, `jdbc`

Description: A plugin string (see Section 4, “ Plugin Configuration ”) describing a `org.apache.openjpa.kernel.SavepointManager` to use for managing transaction savepoints. See Section 4, “ Savepoints ” for details.

### 5.67. openjpa.Sequence

Property name: `openjpa.Sequence`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getSequence`

Resource adaptor config-property: `Sequence`

Default: `table`

Description: A plugin string (see Section 4, “ Plugin Configuration ”) describing the `org.apache.openjpa.kernel.Seq` implementation to use for the system sequence. See Section 6, “ Generators ” for more information.

### 5.68. openjpa.Specification

Property name: `openjpa.Specification`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getSpecificationInstance`

Resource adaptor config-property: `Specification`

Default: `table`

Description: A formatted string describing the Specification to use for the default configuration options. The format of the Specifcation string is `name [major.[minor]]` where `name` denotes the name of the Specification such as `JPA` or `JDO`, `major` denotes the major integral version number of the Specification and `minor` denotes a minor version which can be an arbitrary string. See Section 6.20, “Compatibility with Specification” for more information.

### 5.69. openjpa.TransactionMode

Property name: `openjpa.TransactionMode`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getTransactionMode`

Resource adaptor config-property: `TransactionMode`

Default: `local`

Possible values: `local`, `managed`

Description: The default transaction mode to use. You can override this setting per-session.

### 5.70. openjpa.UseTCCLinSelectNew

Property name: `openjpa.UseTCCLinSelectNew`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getUseTCCLinSelectNew`

Resource adaptor config-property: `UseTCCLinSelectNew`

Default: `false`

Since: `OpenJPA-2.4.2`

Possible values: `true`, `false`

Description: Whether to try to use the ThreadContextClassLoader as fallback if the given class in a `SELECT NEW` statement could not be found with the default ClassLoader. This is mostly useful in EAR and OSGi environments. By default the ClassLoader of the entity is used.

### 5.71. openjpa.WriteLockLevel

Property name: `openjpa.WriteLockLevel`

Configuration API: `org.apache.openjpa.conf.OpenJPAConfiguration.getWriteLockLevel`

Resource adaptor config-property: `WriteLockLevel`

Default: `write`

Possible values: `none`, `read`, `write`, `optimistic`, `optimistic-force-increment`, `pessimistic-read`, `pessimistic-write`, `pessimistic-force-increment`, numeric values for lock-manager specific lock levels.

Description: The default level at which to lock objects changed during a non-optimistic transaction. Note that for the default JDBC lock manager, `read` and `write` lock levels are equivalent. Lock levels `pessimistic-read`, `pessimistic-write` and `pessimistic-force-increment` are in effect only when the `mixed` lock manager is used.

Prev | Up | Next
4. Plugin Configuration | Home | 6. OpenJPA JDBC Properties