Home » openejb-3.1.2-src » org.apache » openejb » persistence » [javadoc | source]
public class: JtaEntityManagerRegistry [javadoc | source]
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.
 public JtaEntityManagerRegistry(TransactionSynchronizationRegistry transactionSynchronizationRegistry) 
    Creates a JtaEntityManagerRegistry using the specified transactionSynchronizationRegistry for the registry if transaction associated entity managers.
Method from org.apache.openejb.persistence.JtaEntityManagerRegistry Summary:
addEntityManagers,   getEntityManager,   getInheritedEntityManager,   isTransactionActive,   removeEntityManagers,   transactionStarted
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.openejb.persistence.JtaEntityManagerRegistry Detail:
 public  void addEntityManagers(String deploymentId,
    Object primaryKey,
    Map<EntityManagerFactory, EntityManager> entityManagers) throws EntityManagerAlreadyRegisteredException 
    Adds the entity managers for the specified component to the registry. This should be called when the component is entered.
 public EntityManager getEntityManager(EntityManagerFactory entityManagerFactory,
    Map properties,
    boolean extended) throws IllegalStateException 
    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.

    It is important that a component adds extended scoped entity managers to this registry when the component is entered and removes them when exited. If this registration is not preformed, an IllegalStateException will be thrown when entity manger is fetched.
 public EntityManager getInheritedEntityManager(EntityManagerFactory entityManagerFactory) 
    Gets an exiting extended entity manager created by a component down the call stack.
 public boolean isTransactionActive() 
    Is a transaction active?
 public  void removeEntityManagers(String deploymentId,
    Object primaryKey) 
    Removed the registered entity managers for the specified component.
 public  void transactionStarted(String deploymentId,
    Object primaryKey) 
    Notifies the registry that a user transaction has been started or the specified component. When a transaction is started for a component with registered extended entity managers, the entity managers are enrolled in the transaction.