ObjectDB ObjectDB

getPersistenceManagerProxy() - JDO PersistenceManagerFactory's method

Method
javax.jdo.PersistenceManagerFactory
PersistenceManager getPersistenceManagerProxy()

Get a thread-safe instance of a proxy that dynamically binds on each method call to an instance of PersistenceManager.

When used with a PersistenceManagerFactory that uses TransactionType JTA, the proxy can be used in a server to dynamically bind to an instance from this factory associated with the thread's current transaction. In this case, the close method is ignored, as the PersistenceManager is automatically closed when the transaction completes.

When used with a PersistenceManagerFactory that uses TransactionType RESOURCE_LOCAL, the proxy uses an inheritable ThreadLocal to bind to an instance of PersistenceManager associated with the thread. In this case, the close method executed on the proxy closes the PersistenceManager and then clears the ThreadLocal. Use of this method does not affect the configurability of the PersistenceManagerFactory.

Returns:
a PersistenceManager proxy.
Since:
JDO 2.1