Methods Summary |
---|
public javax.persistence.EntityManager | createEntityManager()
return entityManagerFactory.createEntityManager();
|
public void | destroy()
entityManagerFactory.close();
|
public javax.persistence.EntityManagerFactory | getEntityManagerFactory()
return entityManagerFactory;
|
public java.lang.String | getKernelName()
return kernelName;
|
public javax.persistence.EntityManager | getNonTxEntityManager()
Map map = nonTxStack.get();
EntityManager em = (EntityManager)map.get(this);
if (em == null)
{
em = entityManagerFactory.createEntityManager();
map.put(this, em);
}
return em;
|
public javax.persistence.EntityManager | getTransactionScopedEntityManager()
Transaction tx = session.getTransaction();
if (tx == null || !TxUtils.isActive(tx)) return getNonTxEntityManager();
EntityManager rtnSession = (EntityManager) session.get();
if (rtnSession == null)
{
rtnSession = createEntityManager();
try
{
tx.registerSynchronization(new SessionSynchronization(rtnSession, tx, true));
}
catch (RollbackException e)
{
throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
}
catch (SystemException e)
{
throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
}
session.set(rtnSession);
rtnSession.joinTransaction(); // force registration with TX
}
return rtnSession;
|
public org.jboss.tm.TransactionLocal | getTransactionSession()
return session;
|
public boolean | isInTx()
Transaction tx = session.getTransaction();
if (tx == null || !TxUtils.isActive(tx)) return false;
return true;
|
public void | registerExtendedWithTransaction(javax.persistence.EntityManager pc)
pc.joinTransaction();
session.set(pc);
|
public void | verifyInTx()
Transaction tx = session.getTransaction();
if (tx == null || !TxUtils.isActive(tx)) throw new TransactionRequiredException("EntityManager must be access within a transaction");
if (!TxUtils.isActive(tx))
throw new TransactionRequiredException("Transaction must be active to access EntityManager");
|