Cayenne application deployment is about configuring the application so that at runtime it can find a main project file (cayenne.xml) and associated resources, such as DataMap and DataNode XML files.

The central point in Cayenne deployment is the Configuration class. It locates and loads all the mapping and configuration information required for Cayenne at runtime. By default Configuration uses a singleton model, i.e. normally there is only one instance of Configuration (or a subclass) that exists in the application. This shared instance can be accessed in the following way:

import org.apache.cayenne.conf.Configuration;
import org.apache.cayenne.access.DataDomain;
Configuration conf = Configuration.getSharedConfiguration();
DataDomain domain = conf.getDomain();

As discussed in the following chapters Configuration works behind the scenes and users rarely care about it. Application code is normally only concered with obtaining a DataContext.


  1. Standalone Applications
  2. Web Applications
  3. Customizing Configuration
  4. DBCPDataSourceFactory
  5. Using JNDI
  6. Deployment with Ant
  7. Configuring Logging