org.apache.cayenne.jpa
Class ResourceLocalEntityManagerFactory

java.lang.Object
  extended by org.apache.cayenne.jpa.ResourceLocalEntityManagerFactory
Direct Known Subclasses:
JtaEntityManagerFactory

public class ResourceLocalEntityManagerFactory
extends Object

A Cayenne EntityManagerFactory that supports resource-local transactions.

Author:
Andrus Adamchik

Field Summary
protected  DataDomain domain
           
protected  boolean open
           
protected  Provider provider
           
protected  PersistenceUnitInfo unitInfo
           
 
Constructor Summary
ResourceLocalEntityManagerFactory(Provider provider, DataDomain domain, PersistenceUnitInfo unitInfo)
          Creates a new JpaEntityManagerFactory.
 
Method Summary
 void close()
          Close the factory, releasing any resources that it holds.
 EntityManager createEntityManager()
          Create a new EntityManager.
 EntityManager createEntityManager(Map map)
          Creates a new resource-local EntityManager with the specified map of properties.
protected  ObjectContext createObjectContext()
          Creates a new Cayenne ObjectContext based on this factory DataDomain.
protected  PersistenceUnitInfo getPersistenceUnitInfo()
          Returns wrapped unit.
 Provider getProvider()
          Returns a parent persistence provider.
 boolean isOpen()
          Indicates whether the factory is open.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

domain

protected DataDomain domain

open

protected boolean open

unitInfo

protected PersistenceUnitInfo unitInfo

provider

protected Provider provider
Constructor Detail

ResourceLocalEntityManagerFactory

public ResourceLocalEntityManagerFactory(Provider provider,
                                         DataDomain domain,
                                         PersistenceUnitInfo unitInfo)
Creates a new JpaEntityManagerFactory.

Method Detail

getPersistenceUnitInfo

protected PersistenceUnitInfo getPersistenceUnitInfo()
Returns wrapped unit.


isOpen

public boolean isOpen()
Indicates whether the factory is open. Returns true until the factory has been closed.


close

public void close()
Close the factory, releasing any resources that it holds. After a factory instance is closed, all methods invoked on it will throw an IllegalStateException, except for isOpen, which will return false.


createEntityManager

public EntityManager createEntityManager()
Create a new EntityManager. Returns a new EntityManager instance every time it is invoked. The EntityManager#isOpen() method will return true of the returned instance.

Returns:
a new EntityManager instance.

createEntityManager

public EntityManager createEntityManager(Map map)
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.

Returns:
a new EntityManager instance.

createObjectContext

protected ObjectContext createObjectContext()
Creates a new Cayenne ObjectContext based on this factory DataDomain. Returned context has lifecycle callbacks enabled, as expected in the JPA environment.


getProvider

public Provider getProvider()
Returns a parent persistence provider.



Copyright © 2001-2007 Apache Cayenne. All Rights Reserved.