org.apache.cayenne.jpa
Class JtaEntityManagerFactory

java.lang.Object
  extended by org.apache.cayenne.jpa.ResourceLocalEntityManagerFactory
      extended by 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

Field Summary
protected  TransactionSynchronizationRegistry transactionRegistry
           
 
Fields inherited from class org.apache.cayenne.jpa.ResourceLocalEntityManagerFactory
domain, open, provider, unitInfo
 
Constructor Summary
JtaEntityManagerFactory(Provider provider, DataDomain domain, PersistenceUnitInfo unitInfo)
           
 
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 org.apache.cayenne.jpa.ResourceLocalEntityManagerFactory
close, createEntityManager, createObjectContext, getPersistenceUnitInfo, getProvider, isOpen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transactionRegistry

protected TransactionSynchronizationRegistry transactionRegistry
Constructor Detail

JtaEntityManagerFactory

public JtaEntityManagerFactory(Provider provider,
                               DataDomain domain,
                               PersistenceUnitInfo unitInfo)
Method Detail

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.