org.apache.cayenne.jpa
Class Provider

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

public class Provider
extends Object

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.
 EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo unit, Map map)
          Called by the container when an EntityManagerFactory is to be created.
protected  DbAdapter createCustomAdapter(EntityMapLoaderContext context, PersistenceUnitInfo info)
           
 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 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).


createContainerEntityManagerFactory

public EntityManagerFactory createContainerEntityManagerFactory(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.


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,
                                        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)


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