org.objectweb.easybeans.persistence.api
Interface EZBPersistenceUnitManager

All Known Implementing Classes:
PersistenceUnitManager

public interface EZBPersistenceUnitManager

Allows to get persistence units and allow to return EntityManager or EntityManagerFactory.

Author:
Florent Benoit

Method Summary
 void addCurrent()
          Create a new EntityManager on each PersistenceContext.
 void closeCurrentAndReturnToPrevious()
          Sets back to the previous entity manager and close the current entity manager for each persistence context.
 javax.persistence.EntityManager getEntityManager(java.lang.String unitName, javax.persistence.PersistenceContextType type)
          Gets an entity manager for the given unit name and the extra attributes.
 javax.persistence.EntityManagerFactory getEntityManagerFactory(java.lang.String unitName)
          Gets an entity manager factory for the given unit name.
 void merge(EZBPersistenceUnitManager otherPersistenceUnitManager)
          Merge the persistence context of a an other persistent unit manager in this one.
 

Method Detail

getEntityManager

javax.persistence.EntityManager getEntityManager(java.lang.String unitName,
                                                 javax.persistence.PersistenceContextType type)
Gets an entity manager for the given unit name and the extra attributes.

Parameters:
unitName - the name of the persistence unit
type - the type of the persistence context
Returns:
entity manager corresponding to arguments

getEntityManagerFactory

javax.persistence.EntityManagerFactory getEntityManagerFactory(java.lang.String unitName)
Gets an entity manager factory for the given unit name.

Parameters:
unitName - the name of the persistence unit
Returns:
entity manager factory.

addCurrent

void addCurrent()
Create a new EntityManager on each PersistenceContext. (Will be used for the method lifecycle)


closeCurrentAndReturnToPrevious

void closeCurrentAndReturnToPrevious()
Sets back to the previous entity manager and close the current entity manager for each persistence context.


merge

void merge(EZBPersistenceUnitManager otherPersistenceUnitManager)
Merge the persistence context of a an other persistent unit manager in this one. Note that as specified in chapter 6.2.2 (persistence unit scope), an EAR level component level will only be seen by a subcomponent if it was not redefined. In our case : don't merge the given unit-name if the current manager defines this unit-name.

Parameters:
otherPersistenceUnitManager - the other persistence unit manager that will be merged into this one.