org.objectweb.easybeans.persistence
Class JPersistenceContext

java.lang.Object
  extended by org.objectweb.easybeans.persistence.JPersistenceContext

public class JPersistenceContext
extends java.lang.Object

This class manages persistence contexts associated to a persistence unit.

Author:
Florent Benoit

Field Summary
private  EntityManagerFactory entityManagerFactory
          EntityManager factory.
private  JPersistenceUnitInfo jPersistenceUnitInfo
          Persistence unit info used by this persistence context.
private  TxEntityManager txEntityManager
          Tx entity manager.
private  TxEntityManagerHandler txEntityManagerHandler
          Tx entity manager handler.
 
Constructor Summary
JPersistenceContext(JPersistenceUnitInfo jPersistenceUnitInfo)
          Build a new persistence context based on a given persistence-unit info.
 
Method Summary
 void addCurrent()
          Sets the current entity manager (used when to transaction is active).
 void closeCurrentAndReturnToPrevious()
          Sets back to the previous entity manager and close the current entity manager.
 EntityManagerFactory getEntityManagerFactory()
          Gets the EntityManager factory.
 EntityManager getTxEntityManager()
          Gets the EntityManager used for Transaction-Scoped.
private  void init()
          Initialize entity manager (and some factoriese) used by Java EE components.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jPersistenceUnitInfo

private JPersistenceUnitInfo jPersistenceUnitInfo
Persistence unit info used by this persistence context.


entityManagerFactory

private EntityManagerFactory entityManagerFactory
EntityManager factory.


txEntityManagerHandler

private TxEntityManagerHandler txEntityManagerHandler
Tx entity manager handler.


txEntityManager

private TxEntityManager txEntityManager
Tx entity manager.

Constructor Detail

JPersistenceContext

public JPersistenceContext(JPersistenceUnitInfo jPersistenceUnitInfo)
Build a new persistence context based on a given persistence-unit info.

Parameters:
jPersistenceUnitInfo - information on the persistence unit.
Method Detail

init

private void init()
Initialize entity manager (and some factoriese) used by Java EE components.


getTxEntityManager

public EntityManager getTxEntityManager()
Gets the EntityManager used for Transaction-Scoped.

Returns:
the EntityManager used for Transaction-Scoped

getEntityManagerFactory

public EntityManagerFactory getEntityManagerFactory()
Gets the EntityManager factory.

Returns:
the EntityManager factory

addCurrent

public void addCurrent()
Sets the current entity manager (used when to transaction is active).


closeCurrentAndReturnToPrevious

public void closeCurrentAndReturnToPrevious()
Sets back to the previous entity manager and close the current entity manager.