org.apache.cayenne.jpa
Class JtaEntityManagerFactory
java.lang.Object
org.apache.cayenne.jpa.ResourceLocalEntityManagerFactory
org.apache.cayenne.jpa.JtaEntityManagerFactory
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.
- Author:
- Andrus Adamchik
Method Summary |
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,
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 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.
- Overrides:
createEntityManager
in class ResourceLocalEntityManagerFactory
- Returns:
- a new EntityManager instance.
Copyright © 2001-2007 Apache Cayenne. All Rights Reserved.