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 Provider

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

All Implemented Interfaces:
  javax.persistence.spi.PersistenceProvider

    public class Provider

extends Object
implements javax.persistence.spi.PersistenceProvider

A PersistenceProvider implementation based on Cayenne stack. Wraps a Cayenne Configuration instance.

Author:
  Andrus Adamchik

Field Summary
`static String` | `ADAPTER_PROPERTY`
`protected Configuration` | `configuration`
`static String` | `CREATE_SCHEMA_PROPERTY`
`static String` | `DATA_SOURCE_DRIVER_PROPERTY`
`static String` | `DATA_SOURCE_FACTORY_PROPERTY`
`static String` | `DATA_SOURCE_MAX_CONNECTIONS_PROPERTY`
`static String` | `DATA_SOURCE_MIN_CONNECTIONS_PROPERTY`
`static String` | `DATA_SOURCE_PASSWORD_PROPERTY`
`static String` | `DATA_SOURCE_URL_PROPERTY`
`static String` | `DATA_SOURCE_USER_NAME_PROPERTY`
`protected Properties` | `defaultProperties`
`static String` | `JTA_DATA_SOURCE_PROPERTY`
`protected org.apache.commons.logging.Log` | `logger`
`static String` | `NON_JTA_DATA_SOURCE_PROPERTY`
`static String` | `PROVIDER_PROPERTY`
`static String` | `TRANSACTION_TYPE_PROPERTY`
`protected UnitLoader` | `unitLoader`
`protected boolean` | `validateDescriptors`

Constructor Summary
`Provider()` Creates a new PersistenceProvider with properties configured to run in a standalone mode with Cayenne stack.
`Provider(boolean validateDescriptors)`

Method Summary
`protected void` | `configureDefaultProperties()`
`protected void` | `configureEnvironmentProperties()` Loads default properties from the Java environment.
`javax.persistence.EntityManagerFactory` | `createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo unit, Map map)` Called by the container when an EntityManagerFactory is to be created.
`protected DbAdapter` | `createCustomAdapter(EntityMapLoaderContext context, javax.persistence.spi.PersistenceUnitInfo info)`
`javax.persistence.EntityManagerFactory` | `createEntityManagerFactory(String emName, Map map)` Called by Persistence class when an EntityManagerFactory is to be created.
`Configuration` | `getConfiguration()`
`protected String` | `getDefaultProperty(String key)`
`protected UnitLoader` | `getUnitLoader()` Returns unit loader, lazily creating it on first invocation.
`protected void` | `loadSchema(DataSource dataSource, DbAdapter adapter, DataMap map)` Loads database schema if it doesn't yet exist.
`protected JpaUnit` | `loadUnit(String emName)` Loads a named JpaUnit using internal UnitLoader.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PROVIDER_PROPERTY

    public static final String PROVIDER_PROPERTY

See Also:
  Constant Field Values

### TRANSACTION_TYPE_PROPERTY

    public static final String TRANSACTION_TYPE_PROPERTY

See Also:
  Constant Field Values

### JTA_DATA_SOURCE_PROPERTY

    public static final String JTA_DATA_SOURCE_PROPERTY

See Also:
  Constant Field Values

### NON_JTA_DATA_SOURCE_PROPERTY

    public static final String NON_JTA_DATA_SOURCE_PROPERTY

See Also:
  Constant Field Values

### CREATE_SCHEMA_PROPERTY

    public static final String CREATE_SCHEMA_PROPERTY

See Also:
  Constant Field Values

### DATA_SOURCE_FACTORY_PROPERTY

    public static final String DATA_SOURCE_FACTORY_PROPERTY

See Also:
  Constant Field Values

### ADAPTER_PROPERTY

    public static final String ADAPTER_PROPERTY

See Also:
  Constant Field Values

### DATA_SOURCE_DRIVER_PROPERTY

    public static final String DATA_SOURCE_DRIVER_PROPERTY

See Also:
  Constant Field Values

### DATA_SOURCE_URL_PROPERTY

    public static final String DATA_SOURCE_URL_PROPERTY

See Also:
  Constant Field Values

### DATA_SOURCE_USER_NAME_PROPERTY

    public static final String DATA_SOURCE_USER_NAME_PROPERTY

See Also:
  Constant Field Values

### DATA_SOURCE_PASSWORD_PROPERTY

    public static final String DATA_SOURCE_PASSWORD_PROPERTY

See Also:
  Constant Field Values

### DATA_SOURCE_MIN_CONNECTIONS_PROPERTY

    public static final String DATA_SOURCE_MIN_CONNECTIONS_PROPERTY

See Also:
  Constant Field Values

### DATA_SOURCE_MAX_CONNECTIONS_PROPERTY

    public static final String DATA_SOURCE_MAX_CONNECTIONS_PROPERTY

See Also:
  Constant Field Values

### validateDescriptors

    protected boolean validateDescriptors

### unitLoader

    protected UnitLoader unitLoader

### defaultProperties

    protected Properties defaultProperties

### configuration

    protected Configuration configuration

### logger

    protected org.apache.commons.logging.Log logger

Constructor Detail

### Provider

    public Provider()

  Creates a new PersistenceProvider with properties configured to run in a standalone mode with Cayenne stack.

### Provider

    public Provider(boolean validateDescriptors)

Method Detail

### configureEnvironmentProperties

    protected void configureEnvironmentProperties()

  Loads default properties from the Java environment.

### configureDefaultProperties

    protected void configureDefaultProperties()

### createEntityManagerFactory

    public javax.persistence.EntityManagerFactory createEntityManagerFactory(String emName,
                                                                             Map map)

  Called by Persistence class when an EntityManagerFactory is to be created. Creates a `JpaUnit` and calls `createContainerEntityManagerFactory(PersistenceUnitInfo, Map)`.

  Specified by:
    `createEntityManagerFactory` in interface `javax.persistence.spi.PersistenceProvider`

### createContainerEntityManagerFactory

    public javax.persistence.EntityManagerFactory createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo unit,
                                                                                      Map map)

  Called by the container when an EntityManagerFactory is to be created. Returns a `EntityManagerFactory` which is a DataDomain wrapper. Note that Cayenne provider will ignore all but 'javax.persistence.transactionType' property in the passed property map.

  Specified by:
    `createContainerEntityManagerFactory` in interface `javax.persistence.spi.PersistenceProvider`

### loadSchema

    protected void loadSchema(DataSource dataSource,
                              DbAdapter adapter,
                              DataMap map)

  Loads database schema if it doesn't yet exist.

### createCustomAdapter

    protected DbAdapter createCustomAdapter(EntityMapLoaderContext context,
                                            javax.persistence.spi.PersistenceUnitInfo info)

### getConfiguration

    public Configuration getConfiguration()

### loadUnit

    protected JpaUnit loadUnit(String emName)

  Loads a named JpaUnit using internal UnitLoader.

### getUnitLoader

    protected UnitLoader getUnitLoader()

  Returns unit loader, lazily creating it on first invocation.

### getDefaultProperty

    protected String getDefaultProperty(String key)

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-2007 Apache Cayenne. All Rights Reserved.