FileDocCategorySizeDatePackage
ExtendedEntityManager.javaAPI DocJBoss 4.2.15278Fri Jul 13 20:53:58 BST 2007org.jboss.ejb3.entity

ExtendedEntityManager

public class ExtendedEntityManager extends Object implements HibernateSession, EntityManager, Serializable, ExtendedPersistenceContext
EntityManager a managed extended persistence context.
author
Bill Burke

Fields Summary
private static final long
serialVersionUID
private String
identity
Constructors Summary
public ExtendedEntityManager(String name)


     
   
      this.identity = name;
   
public ExtendedEntityManager()

   
Methods Summary
public voidclear()

      getPersistenceContext().clear();
   
public voidclose()

      throw new IllegalStateException("It is illegal to close an injected EntityManager");
   
public booleancontains(java.lang.Object entity)

      return getPersistenceContext().contains(entity);
   
public javax.persistence.QuerycreateNamedQuery(java.lang.String name)

      return getPersistenceContext().createNamedQuery(name);
   
public javax.persistence.QuerycreateNativeQuery(java.lang.String sqlString)

      return getPersistenceContext().createNativeQuery(sqlString);
   
public javax.persistence.QuerycreateNativeQuery(java.lang.String sqlString, java.lang.Class resultClass)

      return getPersistenceContext().createNativeQuery(sqlString, resultClass);
   
public javax.persistence.QuerycreateNativeQuery(java.lang.String sqlString, java.lang.String resultSetMapping)

      return getPersistenceContext().createNativeQuery(sqlString, resultSetMapping);
   
public javax.persistence.QuerycreateQuery(java.lang.String ejbqlString)

      return getPersistenceContext().createQuery(ejbqlString);
   
public Tfind(java.lang.Class entityClass, java.lang.Object primaryKey)

      return getPersistenceContext().find(entityClass, primaryKey);
   
public voidflush()

      getPersistenceContext().flush();
   
public java.lang.ObjectgetDelegate()

      return getPersistenceContext().getDelegate();
   
public javax.persistence.FlushModeTypegetFlushMode()

      return getPersistenceContext().getFlushMode();
   
public org.hibernate.SessiongetHibernateSession()

      if (getPersistenceContext() instanceof HibernateEntityManager)
      {
         return ((HibernateEntityManager) getPersistenceContext()).getSession();
      }
      throw new RuntimeException("ILLEGAL ACTION:  Not a Hibernate persistence provider");
   
public javax.persistence.EntityManagergetPersistenceContext()

      StatefulBeanContext beanContext = StatefulBeanContext.currentBean.get();
      EntityManager persistenceContext = beanContext.getExtendedPersistenceContext(identity);
      if (persistenceContext == null)
         throw new RuntimeException("Unable to determine persistenceContext: " + identity
                                    + " in injected SFSB: " + beanContext.getContainer().getObjectName());
      return persistenceContext;
   
public TgetReference(java.lang.Class entityClass, java.lang.Object primaryKey)

      return getPersistenceContext().getReference(entityClass, primaryKey);
   
public javax.persistence.EntityTransactiongetTransaction()

      return getPersistenceContext().getTransaction();
   
public booleanisOpen()

      return getPersistenceContext().isOpen();
   
public voidjoinTransaction()

      getPersistenceContext().joinTransaction();
   
public voidlock(java.lang.Object entity, javax.persistence.LockModeType lockMode)

      getPersistenceContext().lock(entity, lockMode);
   
public Tmerge(T entity)

      return getPersistenceContext().merge(entity);
   
public voidpersist(java.lang.Object entity)

      getPersistenceContext().persist(entity);
   
public voidrefresh(java.lang.Object entity)

      getPersistenceContext().refresh(entity);
   
public voidremove(java.lang.Object entity)

      getPersistenceContext().remove(entity);
   
public voidsetFlushMode(javax.persistence.FlushModeType flushMode)

      getPersistenceContext().setFlushMode(flushMode);