org.apache.cayenne.jpa
Class JtaEntityManagerFactory
java.lang.Object
org.apache.cayenne.jpa.ResourceLocalEntityManagerFactory
org.apache.cayenne.jpa.JtaEntityManagerFactory
- All Implemented Interfaces:
- javax.persistence.EntityManagerFactory
public class JtaEntityManagerFactory
- extends ResourceLocalEntityManagerFactory
An EntityManagerFactory that registers all EntityManagers that it creates with an
active JTA Transaction so that they could flush the object state to the database during
commit.
Method Summary |
javax.persistence.EntityManager |
createEntityManager(Map map)
Creates a new resource-local EntityManager with the specified map of properties. |
protected TransactionSynchronizationRegistry |
getTransactionRegistry()
Returns JTA 11 TransactionSynchronizationRegistry, looking it up via JNDI on first
access, and caching it for the following invocations. |
protected boolean |
isActiveTransaction()
Returns whether there is a JTA transaction in progress. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
transactionRegistry
protected TransactionSynchronizationRegistry transactionRegistry
JtaEntityManagerFactory
public JtaEntityManagerFactory(Provider provider,
DataDomain domain,
javax.persistence.spi.PersistenceUnitInfo unitInfo)
getTransactionRegistry
protected TransactionSynchronizationRegistry getTransactionRegistry()
- Returns JTA 11 TransactionSynchronizationRegistry, looking it up via JNDI on first
access, and caching it for the following invocations.
isActiveTransaction
protected boolean isActiveTransaction()
- Returns whether there is a JTA transaction in progress.
createEntityManager
public javax.persistence.EntityManager createEntityManager(Map map)
- Description copied from class:
ResourceLocalEntityManagerFactory
- Creates a new resource-local EntityManager with the specified map of properties.
Returns a new EntityManager instance every time it is invoked. The
EntityManager.isOpen()
method will return true of the returned instance.
Parameter map is ignored as Cayenne provider defines no properties for
EntityManager as of now.
- Specified by:
createEntityManager
in interface javax.persistence.EntityManagerFactory
- Overrides:
createEntityManager
in class ResourceLocalEntityManagerFactory
- Returns:
- a new EntityManager instance.
Copyright © 2001-2008 Apache Cayenne. All Rights Reserved.