Cayenne User Documentation
Cayenne Projects

### Cayenne Projects

Cayenne project is a set of XML configuration files needed for a Java application to work with Cayenne. It is editable by CayenneModeler. A project has roughly the following structure:

This structure is saved in the following set of files:

- cayenne.xml file: This is a main project file in each application. It should always be called `cayenne.xml`. It configures the layout of the data sources used by the application, breaking it by domains and nodes. It also links to other parts of Cayenne project described below. Nodes represent physical datasources. For each database JDBC URL there should be a single node configured. Domains represent virtual datasources that are a combination of one or more physical datasources. In a simplest (and most common) case, there will be only one domain (virtual datasource) that has a single node (physical datasource). But Cayenne is flexible to allow grouping multiple nodes under domains thus hiding lots of underlying details and allowing applications to work with multiple databases as if it was a single one. XML structure of `cayenne.xml` is described in this DTD file.

- DataMap file: Used to instantiate DataMap objects that desribe a database schema and map it to the Java classes in the Java application. XML structure of the DataMap file is described in this DTD file.

- DataSource file: In a standalone Java application, Java code has no access to DataSource objects that are normally provided by deployment containers. Cayenne framework still needs a DataSource to connect to the database. Therefore Cayenne has a set of wrapper classes located in `org.apache.cayenne.conn` package, to create DataSource objects based on regular JDBC drivers. DataSource file provides needed information about database URL, JDBC driver, login, password and connection pooling parameters of a single DataSource. Note: such configuration file can be present in development so that CayenneModeler tool could obtain a database connection, even if an application wouldn't use it in deployment and instead would use a DataSource provided by the container. DTD for the DataSource file can be found here.

.
Copyright ©2001-2010 Apache Software Foundation