|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.openejb.persistence.JtaEntityManagerRegistry
public class JtaEntityManagerRegistry
The JtaEntityManagerRegistry tracks JTA entity managers for transation and extended scoped entity managers. A signle instance of this object should be created and shared by all JtaEntityManagers in the server instance. Failure to do this will result in multiple entity managers being created for a single persistence until, and that will result in cache incoherence.
Constructor Summary | |
---|---|
JtaEntityManagerRegistry(javax.transaction.TransactionSynchronizationRegistry transactionSynchronizationRegistry)
Creates a JtaEntityManagerRegistry using the specified transactionSynchronizationRegistry for the registry if transaction associated entity managers. |
Method Summary | |
---|---|
void |
addEntityManagers(java.lang.String deploymentId,
java.lang.Object primaryKey,
java.util.Map<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager> entityManagers)
Adds the entity managers for the specified component to the registry. |
javax.persistence.EntityManager |
getEntityManager(javax.persistence.EntityManagerFactory entityManagerFactory,
java.util.Map properties,
boolean extended)
Gets an entity manager instance from the transaction registry, extended regitry or for a transaction scoped entity manager, creates a new one when an exisitng instance is not found. |
javax.persistence.EntityManager |
getInheritedEntityManager(javax.persistence.EntityManagerFactory entityManagerFactory)
Gets an exiting extended entity manager created by a component down the call stack. |
boolean |
isTransactionActive()
Is a transaction active? |
void |
removeEntityManagers(java.lang.String deploymentId,
java.lang.Object primaryKey)
Removed the registered entity managers for the specified component. |
void |
transactionStarted(java.lang.String deploymentId,
java.lang.Object primaryKey)
Notifies the registry that a user transaction has been started or the specified component. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JtaEntityManagerRegistry(javax.transaction.TransactionSynchronizationRegistry transactionSynchronizationRegistry)
Method Detail |
---|
public javax.persistence.EntityManager getEntityManager(javax.persistence.EntityManagerFactory entityManagerFactory, java.util.Map properties, boolean extended) throws java.lang.IllegalStateException
entityManagerFactory
- the entity manager factory from which an entity manager is requiredproperties
- the properties passed to the entity manager factory when an entity manager is createdextended
- is the entity manager an extended context
java.lang.IllegalStateException
- if the entity manger is extended and there is not an existing entity manager
instance already registeredpublic void addEntityManagers(java.lang.String deploymentId, java.lang.Object primaryKey, java.util.Map<javax.persistence.EntityManagerFactory,javax.persistence.EntityManager> entityManagers) throws EntityManagerAlreadyRegisteredException
deploymentId
- the id of the componententityManagers
- the entity managers to register
EntityManagerAlreadyRegisteredException
- if an entity manager is already registered with the transaction
for one of the supplied entity manager factories; for EJBs this should be caught and rethown as an EJBExceptionpublic void removeEntityManagers(java.lang.String deploymentId, java.lang.Object primaryKey)
deploymentId
- the id of the componentpublic javax.persistence.EntityManager getInheritedEntityManager(javax.persistence.EntityManagerFactory entityManagerFactory)
entityManagerFactory
- the entity manager factory from which an entity manager is needed
public void transactionStarted(java.lang.String deploymentId, java.lang.Object primaryKey)
deploymentId
- the id of the componentpublic boolean isTransactionActive()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |