Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.jpa
Class ResourceLocalEntityManagerFactory

    java.lang.Object
      org.apache.cayenne.jpa.ResourceLocalEntityManagerFactory

All Implemented Interfaces:
  javax.persistence.EntityManagerFactory

Direct Known Subclasses:
  JtaEntityManagerFactory

    public class ResourceLocalEntityManagerFactory

extends Object
implements javax.persistence.EntityManagerFactory

A Cayenne EntityManagerFactory that supports resource-local transactions.

Author:
  Andrus Adamchik

Field Summary
`protected DataDomain` | `domain`
`protected boolean` | `open`
`protected Provider` | `provider`
`protected javax.persistence.spi.PersistenceUnitInfo` | `unitInfo`

Constructor Summary
`ResourceLocalEntityManagerFactory(Provider provider, DataDomain domain, javax.persistence.spi.PersistenceUnitInfo unitInfo)` Creates a new JpaEntityManagerFactory.

Method Summary
`void` | `close()` Close the factory, releasing any resources that it holds.
`javax.persistence.EntityManager` | `createEntityManager()` Create a new EntityManager.
`javax.persistence.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 javax.persistence.spi.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 javax.persistence.spi.PersistenceUnitInfo unitInfo

### provider

    protected Provider provider

Constructor Detail

### ResourceLocalEntityManagerFactory

    public ResourceLocalEntityManagerFactory(Provider provider,
                                             DataDomain domain,
                                             javax.persistence.spi.PersistenceUnitInfo unitInfo)

  Creates a new JpaEntityManagerFactory.

Method Detail

### getPersistenceUnitInfo

    protected javax.persistence.spi.PersistenceUnitInfo getPersistenceUnitInfo()

  Returns wrapped unit.

### isOpen

    public boolean isOpen()

  Indicates whether the factory is open. Returns true until the factory has been closed.

  Specified by:
    `isOpen` in interface `javax.persistence.EntityManagerFactory`

### 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.

  Specified by:
    `close` in interface `javax.persistence.EntityManagerFactory`

### createEntityManager

    public javax.persistence.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.

  Specified by:
    `createEntityManager` in interface `javax.persistence.EntityManagerFactory`
  Returns:
    a new EntityManager instance.

### createEntityManager

    public javax.persistence.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.

  Specified by:
    `createEntityManager` in interface `javax.persistence.EntityManagerFactory`
  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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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