org.objectweb.easybeans.injection
Class EntityManagerHelper

java.lang.Object
  extended by org.objectweb.easybeans.injection.EntityManagerHelper

public final class EntityManagerHelper
extends java.lang.Object

Helper class for injecting EntityManager instance in the bean.

Author:
Florent Benoit

Field Summary
private static JLog logger
          Logger.
 
Constructor Summary
private EntityManagerHelper()
          Utility class, no public constructor.
 
Method Summary
static EntityManager getEntityManager(EZBEJBContext ejbContext, java.lang.String unitName, PersistenceContextType type)
          Gets an entity manager for the given session Context.
static EntityManagerFactory getEntityManagerFactory(EZBEJBContext ejbContext, java.lang.String unitName)
          Gets an entity manager factory for the given session Context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static JLog logger
Logger.

Constructor Detail

EntityManagerHelper

private EntityManagerHelper()
Utility class, no public constructor.

Method Detail

getEntityManager

public static EntityManager getEntityManager(EZBEJBContext ejbContext,
                                             java.lang.String unitName,
                                             PersistenceContextType type)
Gets an entity manager for the given session Context.

Parameters:
ejbContext - on which we should provide an entity manager.
unitName - name of the persistence unit.
type - the persistence context type.
Returns:
instance of an entity manager which will be used by the bean/interceptor.

getEntityManagerFactory

public static EntityManagerFactory getEntityManagerFactory(EZBEJBContext ejbContext,
                                                           java.lang.String unitName)
Gets an entity manager factory for the given session Context.

Parameters:
ejbContext - on which we should provide an entity manager factory.
unitName - name of the persistence unit.
Returns:
instance of an entity manager factory which will be used by the bean/interceptor.