org.apache.aries.jpa.container.context
Interface JTAPersistenceContextManager


public interface JTAPersistenceContextManager


Method Summary
 javax.persistence.EntityManager getExistingPersistenceContext(javax.persistence.EntityManagerFactory emf)
          Get the existing Transaction scoped PersistenceContext for this transaction and persistence unit
 boolean isTransactionActive()
          Determine whether there is an active transaction
 void manageExistingPersistenceContext(javax.persistence.EntityManagerFactory emf, javax.persistence.EntityManager em)
          Make the supplied EntityManager the current persistence context for this transaction.
 

Method Detail

getExistingPersistenceContext

javax.persistence.EntityManager getExistingPersistenceContext(javax.persistence.EntityManagerFactory emf)
                                                              throws javax.persistence.TransactionRequiredException
Get the existing Transaction scoped PersistenceContext for this transaction and persistence unit

Parameters:
emf - The PersistenceUnit to get a PersistenceContext for
Returns:
An existing transaction scoped PersistenceContext, or null if none already exists
Throws:
javax.persistence.TransactionRequiredException - if there is no current transaction

manageExistingPersistenceContext

void manageExistingPersistenceContext(javax.persistence.EntityManagerFactory emf,
                                      javax.persistence.EntityManager em)
                                      throws javax.persistence.TransactionRequiredException,
                                             java.lang.IllegalStateException
Make the supplied EntityManager the current persistence context for this transaction. The JTAPersistenceContextManager will call EntityManager.joinTransaction() but will not close the EntityManager when the transaction commits. After a successful call to this method, getExistingPersistenceContext(EntityManagerFactory) will return the EntityManager em

Parameters:
emf - The persistence unit
em - The persistence context that will be the "managed" persistence context for the current transaction
Throws:
javax.persistence.TransactionRequiredException - if there is no active transaction
java.lang.IllegalStateException - if there is already a persistence context associated with this transaction

isTransactionActive

boolean isTransactionActive()
Determine whether there is an active transaction



Copyright © 2009-2012 The Apache Software Foundation. All Rights Reserved.