blob: c694c9a68028c354f3439698a2f0004430da0b36 [file] [log] [blame]
Title: Cayenne Projects
<H3><A name="CayenneProjects-CayenneProjects"></A>Cayenne Projects</H3>
<P>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:</P>
<P><SPAN class="image-wrap" style=""><IMG src="cayenne-projects.data/cayenne-project.gif" style="border: 0px solid black"></SPAN></P>
<P>This structure is saved in the following set of files:</P>
<UL class="alternate" type="square">
<LI><B>cayenne.xml file</B>: This is a main project file in each application. It should always be called <TT>cayenne.xml</TT>. 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 <TT>cayenne.xml</TT> is described in this <A href="http://svn.apache.org/repos/asf/incubator/cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/cayenne/dtd/cayenne-project-1_1.dtd" class="external-link" rel="nofollow">DTD file</A>.</LI>
</UL>
<UL class="alternate" type="square">
<LI><B>DataMap file</B>: 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.</LI>
</UL>
<UL class="alternate" type="square">
<LI><B>DataSource file</B>: 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 <TT>org.apache.cayenne.conn</TT> 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. <EM>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</EM>. DTD for the DataSource file can be found <A href="http://svn.apache.org/repos/asf/incubator/cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/cayenne/dtd/cayenne-driver-1_1.dtd" class="external-link" rel="nofollow">here</A>.</LI>
</UL>