You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2010/11/14 08:05:51 UTC

svn commit: r1034943 [1/2] - in /cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide: DataContext/Obtaining DataContext/ Deployment/ Tutorial/ Tutorial/Tutorial Delete/ Tutorial/Tutorial Java Classes/ Tutorial/Tutorial Object...

Author: aadamchik
Date: Sun Nov 14 07:05:50 2010
New Revision: 1034943

URL: http://svn.apache.org/viewvc?rev=1034943&view=rev
Log:
syncing docs from wiki - second pass

Added:
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Delete/
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Delete/index.html   (with props)
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Delete/modeler-deleterule.png
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Java Classes/
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Java Classes/eclipse-generatedclasses.png
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Java Classes/index.html   (with props)
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/database-schema.jpg
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/index.html   (with props)
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/modeler-artistid.png
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/modeler-dbrelationship.png
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial ObjectContext/
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial ObjectContext/index.html   (with props)
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Persistent Objects/
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Persistent Objects/index.html   (with props)
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial SelectQuery/
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial SelectQuery/index.html   (with props)
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Setup/
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Setup/index.html   (with props)
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Setup/maven-plugin-install.png
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/base-datamap.png
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/base-datanode.png
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/eclipse-xmlfiles.png
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/index.html   (with props)
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/modeler-started.png
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/tutorial-eclipse-project.png
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Webapp/
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Webapp/eclipse-mvnrun.png
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Webapp/firefox-webapp.png
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Webapp/index.html   (with props)
Modified:
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/DataContext/Obtaining DataContext/index.html
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Deployment/index.html
    cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/index.html

Modified: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/DataContext/Obtaining DataContext/index.html
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/DataContext/Obtaining%20DataContext/index.html?rev=1034943&r1=1034942&r2=1034943&view=diff
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/DataContext/Obtaining DataContext/index.html (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/DataContext/Obtaining DataContext/index.html Sun Nov 14 07:05:50 2010
@@ -59,7 +59,9 @@
 <li><a href="../../../../Documentation/Cayenne Guide/Customization/index.html">Customization</a></li>
 </ul>
 </div>
-<div id="ConfluenceContent"><p>Depending on deployment environment and application needs, Cayenne can be configured in a few different ways to make DataContext instances available. This is discussed in detail in deployment chapter. In this chapter we assume a properly deployed application and will concentrate on how to obtain a DataContext for the database access. The following are the most common ways to achieve that:</p>
+<div id="ConfluenceContent"><div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="../../../../images/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>TODO... The API below looks different in 3.1</td></tr></table></div>
+
+<p>Depending on deployment environment and application needs, Cayenne can be configured in a few different ways to make DataContext instances available. This is discussed in detail in deployment chapter. In this chapter we assume a properly deployed application and will concentrate on how to obtain a DataContext for the database access. The following are the most common ways to achieve that:</p>
 
 <h3><a name="ObtainingDataContext-CreatingDataContextontheSpot"></a>Creating DataContext on the Spot</h3>
 

Modified: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Deployment/index.html
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Deployment/index.html?rev=1034943&r1=1034942&r2=1034943&view=diff
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Deployment/index.html (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Deployment/index.html Sun Nov 14 07:05:50 2010
@@ -57,6 +57,8 @@
 </div>
 <div id="ConfluenceContent"><h2><a name="Deployment-Deployment"></a>Deployment</h2>
 
+<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="../../../images/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>TODO... This section and all subsections will have to be rewritten for 3.1, which is using DI-based configuration</td></tr></table></div>
+
 <p>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.</p>
 
 <p>The central point in Cayenne deployment is the <a href="http://incubator.apache.org/cayenne/2_0/api/cayenne/org/apache/cayenne/conf/Configuration.html" class="external-link" rel="nofollow">Configuration</a> 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:</p>

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Delete/index.html
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Tutorial/Tutorial%20Delete/index.html?rev=1034943&view=auto
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Delete/index.html (added)
+++ cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Delete/index.html Sun Nov 14 07:05:50 2010
@@ -0,0 +1,133 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+-->
+<html>
+  <head>
+    <title>Apache Cayenne Documentation - Tutorial Delete</title>
+    <style type="text/css">@import "../../../../style.css";</style>
+  </head>
+<body>
+  <div class="header">
+    <div style="float: left;"><a href="http://cayenne.apache.org/"><img src="../../../../images/logo.gif" align="absmiddle" border="0"></a></div>
+    <span class="logoSpaceLink"><a href="../../../../index.html">Cayenne User Documentation</a></span><br />
+    <span class="pagetitle">Tutorial Delete</span>
+  </div>
+<div id="cayenne_toc">
+<ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Introduction/index.html">Introduction</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Installation/index.html">Installation</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/index.html">Tutorial</a><ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Setup/index.html">Tutorial Setup</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/index.html">Tutorial Starting Project</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/index.html">Tutorial Object Relational Mapping</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Java Classes/index.html">Tutorial Java Classes</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial ObjectContext/index.html">Tutorial ObjectContext</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Persistent Objects/index.html">Tutorial Persistent Objects</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial SelectQuery/index.html">Tutorial SelectQuery</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Delete/index.html">Tutorial Delete</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Webapp/index.html">Tutorial Webapp</a></li>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Design/index.html">Design</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/DataContext/index.html">DataContext</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Queries/index.html">Queries</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/DataObjects/index.html">DataObjects</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Stored Procedures/index.html">Stored Procedures</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Expressions/index.html">Expressions</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Lifecycle Callbacks/index.html">Lifecycle Callbacks</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Performance Tuning/index.html">Performance Tuning</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Caching and Fresh Data/index.html">Caching and Fresh Data</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Deployment/index.html">Deployment</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Ant Tasks/index.html">Ant Tasks</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Maven2 Plugins/index.html">Maven2 Plugins</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Customization/index.html">Customization</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent"><p>This section explains how to model relationship delete rules and how to delete individual objects as well as sets of objects. Also demonstrated the use of <tt>Cayenne</tt> class to run a query.</p>
+
+<h3><a name="TutorialDelete-SettingUpDeleteRules"></a>Setting Up Delete Rules</h3>
+
+<p>Before we discuss the API for object deletion, lets go back to CayenneModeler and set up some <a href="../../../../Documentation/Modeler Guide/Modeling Object Layer/Delete Rules/index.html" title="Delete Rules">delete rules</a>. Doing this is optional but will simplify correct handling of the objects related to deleted objects.</p>
+
+<p>In the Modeler go to "Artist" ObjEntity, "Relationships" tab and select "Cascade" for the "paintings" relationship delete rule:</p>
+
+<p><span class="image-wrap" style=""><img src="modeler-deleterule.png?version=1&amp;modificationDate=1289712910487" style="border: 0px solid black" /></span></p>
+
+<p>Repeat this step for other relationships:</p>
+
+<ul>
+	<li>For Gallery set "paintings" relationship to be "Nullify", as a painting can exist without being displayed in a gallery.</li>
+	<li>For Painting et both relationships rules to "Nullify".</li>
+</ul>
+
+
+<p>Now save the mapping, and refresh the project in Eclispe.</p>
+
+<h3><a name="TutorialDelete-DeletingObjects"></a>Deleting Objects</h3>
+
+<p>While deleting objects is possible via SQL, qualifying a delete on one or more IDs, a more common way in Cayenne (or ORM in general) is to get a hold of the object first, and then delete it via the context. Let's use utility class Cayenne to find an artist:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">Expression qualifier = ExpressionFactory.matchExp(Artist.NAME_PROPERTY, <span class="code-quote">"Pablo Picasso"</span>);
+SelectQuery select = <span class="code-keyword">new</span> SelectQuery(Artist.class, qualifier);
+Artist picasso = (Artist) Cayenne.objectForQuery(context, select);</pre>
+</div></div>
+
+<p>Now let's delete the artist:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java"><span class="code-keyword">if</span> (picasso != <span class="code-keyword">null</span>) {
+    context.deleteObject(picasso);
+    context.commitChanges();
+}</pre>
+</div></div>
+
+<p>Since we set up "Cascade" delete rule for the Artist.paintings relationships, Cayenne will automatically delete all paintings of this artist. So when your run the app you'll see this output:</p>
+
+<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
+<pre>INFO: SELECT t0.DATE_OF_BIRTH, t0.ID, t0.NAME FROM ARTIST t0 WHERE t0.NAME = ? 
+ [bind: 1-&gt;NAME:'Pablo Picasso']
+INFO: === returned 1 row. - took 5 ms.
+INFO: +++ transaction committed.
+INFO: --- will run 2 queries.
+INFO: --- transaction started.
+INFO: DELETE FROM PAINTING WHERE ID = ?
+INFO: [batch bind: 1-&gt;ID:2]
+INFO: [batch bind: 1-&gt;ID:1]
+INFO: === updated 2 rows.
+INFO: DELETE FROM ARTIST WHERE ID = ?
+INFO: [batch bind: 1-&gt;ID:1]
+INFO: === updated 1 row.
+INFO: +++ transaction committed.
+</pre>
+</div></div>
+
+<hr />
+<p><b>Next Step: <a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Webapp/index.html" title="Tutorial Webapp">Tutorial Webapp</a></b></p>
+<hr /></div>
+</div>
+  <div class="clearer">.</div>
+  <div style="height: 12px; background-image: url('../../../../images/border_bottom.gif'); background-repeat: repeat-x;"></div>
+
+  <div class="smalltext copyright">
+    Copyright &copy;2001-2010 Apache Software Foundation
+  </div>
+
+</body>
+</html>

Propchange: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Delete/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Delete/modeler-deleterule.png
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Tutorial/Tutorial%20Delete/modeler-deleterule.png?rev=1034943&view=auto
==============================================================================
Files cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Delete/modeler-deleterule.png (added) and cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Delete/modeler-deleterule.png Sun Nov 14 07:05:50 2010 differ

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Java Classes/eclipse-generatedclasses.png
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Tutorial/Tutorial%20Java%20Classes/eclipse-generatedclasses.png?rev=1034943&view=auto
==============================================================================
Files cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Java Classes/eclipse-generatedclasses.png (added) and cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Java Classes/eclipse-generatedclasses.png Sun Nov 14 07:05:50 2010 differ

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Java Classes/index.html
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Tutorial/Tutorial%20Java%20Classes/index.html?rev=1034943&view=auto
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Java Classes/index.html (added)
+++ cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Java Classes/index.html Sun Nov 14 07:05:50 2010
@@ -0,0 +1,119 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+-->
+<html>
+  <head>
+    <title>Apache Cayenne Documentation - Tutorial Java Classes</title>
+    <style type="text/css">@import "../../../../style.css";</style>
+  </head>
+<body>
+  <div class="header">
+    <div style="float: left;"><a href="http://cayenne.apache.org/"><img src="../../../../images/logo.gif" align="absmiddle" border="0"></a></div>
+    <span class="logoSpaceLink"><a href="../../../../index.html">Cayenne User Documentation</a></span><br />
+    <span class="pagetitle">Tutorial Java Classes</span>
+  </div>
+<div id="cayenne_toc">
+<ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Introduction/index.html">Introduction</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Installation/index.html">Installation</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/index.html">Tutorial</a><ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Setup/index.html">Tutorial Setup</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/index.html">Tutorial Starting Project</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/index.html">Tutorial Object Relational Mapping</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Java Classes/index.html">Tutorial Java Classes</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial ObjectContext/index.html">Tutorial ObjectContext</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Persistent Objects/index.html">Tutorial Persistent Objects</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial SelectQuery/index.html">Tutorial SelectQuery</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Delete/index.html">Tutorial Delete</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Webapp/index.html">Tutorial Webapp</a></li>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Design/index.html">Design</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/DataContext/index.html">DataContext</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Queries/index.html">Queries</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/DataObjects/index.html">DataObjects</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Stored Procedures/index.html">Stored Procedures</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Expressions/index.html">Expressions</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Lifecycle Callbacks/index.html">Lifecycle Callbacks</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Performance Tuning/index.html">Performance Tuning</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Caching and Fresh Data/index.html">Caching and Fresh Data</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Deployment/index.html">Deployment</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Ant Tasks/index.html">Ant Tasks</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Maven2 Plugins/index.html">Maven2 Plugins</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Customization/index.html">Customization</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent"><p>Here we'll generate the Java classes from the model that was created in the previous section. CayenneModeler can be used to also generate the database schema, but since we specified "CreateIfNoSchemaStrategy" earlier when we created a DataNode, we'll skip the database schema step. Still be aware that you can do it if you need to via <tt>"Tools &gt; Create Database Schema"</tt>.</p>
+
+<h3><a name="TutorialJavaClasses-CreatingJavaClasses"></a>Creating Java Classes</h3>
+
+<ul>
+	<li>Select <tt>"Tools &gt; Generate Classes"</tt> menu.</li>
+	<li>For "Type" select "Standard Persistent Objects", if it is not already selected.</li>
+	<li>For the "Output Directory" select <tt>"src/main/java"</tt> folder under your Eclipse project folder (this is a "peer" location to the cayenne.xml location we selected before).</li>
+	<li>Click on "Entities" tab and check the "Check All Entities" checkbox (unless it is already checked and reads "Uncheck all Entities").</li>
+	<li>Click "Generate"</li>
+</ul>
+
+
+<p>Now go back to Eclipse, right click on "tutorial" project and select "Refresh" - you should see pairs of classes generated for each mapped entity. You probably also see that there's a bunch of red squiggles next to the newly generated Java classes in Eclipse. This is because our project does not include Cayenne as a Maven dependency yet. Let's fix it now by adding "cayenne-server" artifact in the bottom of the <tt>pom.xml</tt> file. The resulting POM should look like this:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">&lt;project xmlns=<span class="code-quote">"http:<span class="code-comment">//maven.apache.org/POM/4.0.0"</span> xmlns:xsi=<span class="code-quote">"http://www.w3.org/2001/XMLSchema-instance"</span>
+</span>	xsi:schemaLocation=<span class="code-quote">"http:<span class="code-comment">//maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"</span>&gt;
+</span>	&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
+	&lt;groupId&gt;org.example.cayenne&lt;/groupId&gt;
+	&lt;artifactId&gt;tutorial&lt;/artifactId&gt;
+	&lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
+
+	&lt;dependencies&gt;
+		&lt;dependency&gt;
+			&lt;groupId&gt;org.apache.cayenne&lt;/groupId&gt;
+			&lt;artifactId&gt;cayenne-server&lt;/artifactId&gt;
+   &lt;!-- Here specify the version of Cayenne you are actually using --&gt;
+			&lt;version&gt;3.1M1&lt;/version&gt;
+		&lt;/dependency&gt;
+	&lt;/dependencies&gt;
+&lt;/project&gt;</pre>
+</div></div>
+
+<p>Your computer must be connected to the internet. Once you save the pom.xml, Eclipse will download the needed Cayenne jar file and add it to the project build path. As a result, all the errors should disappear.</p>
+
+<p>Now let's check the entity class pairs. Each one is made of a superclass (e.g. <em>Artist) and a subclass (e.g. Artist). You <b>should not</b> modify the superclasses whose names start with "</em>" (underscore), as they will be replaced on subsequent generator runs. Instead all custom logic should be placed in the subclasses in <tt>"org.example.cayenne.persistent"</tt> package - those will never be overwritten by the class generator.</p>
+
+<p><span class="image-wrap" style=""><img src="eclipse-generatedclasses.png?version=1&amp;modificationDate=1289712337909" style="border: 0px solid black" /></span></p>
+
+
+<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="../../../../images/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Class Generation Hint</b><br />Often you'd start by generating classes from the Modeler, but at the later stages of the project the generation is usually automated either via <a href="../../../../Documentation/Cayenne Guide/Ant Tasks/cgen/index.html" title="cgen">Ant cgen task</a> or <a href="../../../../Documentation/Cayenne Guide/Maven2 Plugins/maven2-cgen/index.html" title="maven2-cgen">Maven cgen mojo</a>. All three methods are interchangeable, however Ant and Maven methods would ensure that you never forget to regenerate classes on mapping changes, as they are integrated into the build cycle.</td></tr></table></div>
+
+
+<hr />
+<p><b>Next Step: <a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial ObjectContext/index.html" title="Tutorial ObjectContext">Tutorial ObjectContext</a></b></p>
+<hr /></div>
+</div>
+  <div class="clearer">.</div>
+  <div style="height: 12px; background-image: url('../../../../images/border_bottom.gif'); background-repeat: repeat-x;"></div>
+
+  <div class="smalltext copyright">
+    Copyright &copy;2001-2010 Apache Software Foundation
+  </div>
+
+</body>
+</html>

Propchange: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Java Classes/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/database-schema.jpg
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Tutorial/Tutorial%20Object%20Relational%20Mapping/database-schema.jpg?rev=1034943&view=auto
==============================================================================
Files cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/database-schema.jpg (added) and cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/database-schema.jpg Sun Nov 14 07:05:50 2010 differ

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/index.html
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Tutorial/Tutorial%20Object%20Relational%20Mapping/index.html?rev=1034943&view=auto
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/index.html (added)
+++ cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/index.html Sun Nov 14 07:05:50 2010
@@ -0,0 +1,138 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+-->
+<html>
+  <head>
+    <title>Apache Cayenne Documentation - Tutorial Object Relational Mapping</title>
+    <style type="text/css">@import "../../../../style.css";</style>
+  </head>
+<body>
+  <div class="header">
+    <div style="float: left;"><a href="http://cayenne.apache.org/"><img src="../../../../images/logo.gif" align="absmiddle" border="0"></a></div>
+    <span class="logoSpaceLink"><a href="../../../../index.html">Cayenne User Documentation</a></span><br />
+    <span class="pagetitle">Tutorial Object Relational Mapping</span>
+  </div>
+<div id="cayenne_toc">
+<ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Introduction/index.html">Introduction</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Installation/index.html">Installation</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/index.html">Tutorial</a><ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Setup/index.html">Tutorial Setup</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/index.html">Tutorial Starting Project</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/index.html">Tutorial Object Relational Mapping</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Java Classes/index.html">Tutorial Java Classes</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial ObjectContext/index.html">Tutorial ObjectContext</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Persistent Objects/index.html">Tutorial Persistent Objects</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial SelectQuery/index.html">Tutorial SelectQuery</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Delete/index.html">Tutorial Delete</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Webapp/index.html">Tutorial Webapp</a></li>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Design/index.html">Design</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/DataContext/index.html">DataContext</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Queries/index.html">Queries</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/DataObjects/index.html">DataObjects</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Stored Procedures/index.html">Stored Procedures</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Expressions/index.html">Expressions</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Lifecycle Callbacks/index.html">Lifecycle Callbacks</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Performance Tuning/index.html">Performance Tuning</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Caching and Fresh Data/index.html">Caching and Fresh Data</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Deployment/index.html">Deployment</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Ant Tasks/index.html">Ant Tasks</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Maven2 Plugins/index.html">Maven2 Plugins</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Customization/index.html">Customization</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent"><p>The goal of this section is to learn how to create a simple Object-Relational model with CayenneModeler. We will create a complete ORM model for the following database schema:</p>
+
+<p><span class="image-wrap" style=""><img src="database-schema.jpg?version=1&amp;modificationDate=1289713490301" style="border: 0px solid black" /></span></p>
+
+<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="../../../../images/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>Very often you'd have an existing database already, and it can be quickly imported in Cayenne via <tt>"Tools &gt; Reengineer Database Schema"</tt>. This will save you lots of time compared to manual mapping. However understanding how to create the mapping by hand is important, so we are showing the "manual" approach below.</td></tr></table></div>
+
+<h3><a name="TutorialObjectRelationalMapping-MappingDatabaseTablesandColumns"></a>Mapping Database Tables and Columns</h3>
+
+<p>Lets go back to CayenneModeler where we have the newly created project open and start by adding the ARTIST table. Database tables are called <b>"DbEntities"</b> in Cayenne mapping (those can be actual tables or database views). </p>
+
+<p>Select "UntitledDomainMap" on the left-hand side project tree and click "Create DbEntity" button (or use <tt>"Project &gt; Create DbEntity"</tt> menu). A new DbEntity is created. In "DbEntity Name" field enter "ARTIST". Then click on "Create Attribute" button on the entity toolbar (third button from the left). This action changes the view to the "Attribute" tab and adds a new attribute (attribute means a "table column" in this case) called "untitledAttr". Let's rename it to ID, make it an INTEGER and make it a PK:</p>
+
+<p><span class="image-wrap" style=""><img src="modeler-artistid.png?version=1&amp;modificationDate=1289713490497" style="border: 0px solid black" /></span></p>
+
+<p>Similarly add NAME VARCHAR(200) and DATE_OF_BIRTH DATE attributes.  After that repeat this procedure for PAINTING and GALLERY entities to match DB schema shown above.</p>
+
+<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="../../../../images/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>Don't forget to save your project periodically to avoid losing your work. You will also have to refresh the project in Eclipse after every CayenneModeler save, as Eclipse is by default unaware of any changes made in the Modeler.</td></tr></table></div>
+
+<h3><a name="TutorialObjectRelationalMapping-MappingDatabaseRelationships"></a>Mapping Database Relationships</h3>
+
+<p>Now we need to specify relationships between ARTIST, PAINTING and GALLERY tables. Start by creating a one-to-many ARTIST/PAINTING relationship:</p>
+
+<ul>
+	<li>Select the ARTIST DbEntity on the left and click on the "Relationships" tab.</li>
+	<li>Click on "Create Relationship" button on the entity toolbar (second button from the left) - a relationship called "untitledRel" is created.</li>
+	<li>Choose the "Target" to be "Painting".</li>
+	<li>Click on the "Database Mapping" button (letter "I" in a circle) - relationship configuration dialog is presented. Here you can assign a name to the relationship and also its complimentary reverse relationship. This name can be anything (this is really a symbolic name of the database referential constraint), but it is recommended to use a valid Java identifier, as this will save some typing later. We'll call the relationship "paintings" and reverse relationship "artist".</li>
+	<li>Click on "Add" button on the right to add a join</li>
+	<li>Select "ID" column for the "Source" and "ARTIST_ID" column for the target.</li>
+	<li>Relationship information should now look like this:</li>
+</ul>
+
+
+<p><span class="image-wrap" style=""><img src="modeler-dbrelationship.png?version=1&amp;modificationDate=1289713492360" style="border: 0px solid black" /></span></p>
+
+<ul>
+	<li>Click "Done" to confirm the changes and close the dialog.</li>
+	<li>Two complimentary relationships have been created - from ARTIST to PAINTING and back. Still you may have noticed one thing is missing - "paintings" relationship should be to-many, but "To Many" checkbox is not checked. Let's change that - check the checkbox for "paintings" relationship, and then click on PAINTING DbEntity, and uncheck "artist" relationship "To Many" to make the reverse relationship "to-one" as it should be.</li>
+	<li>Repeat the steps above to create a many-to-one relationship from PAINTING to GALLERY, calling the relationships pair "gallery" and "paintings".</li>
+</ul>
+
+
+<h3><a name="TutorialObjectRelationalMapping-MappingJavaClasses"></a>Mapping Java Classes</h3>
+
+<p>Now that the database schema mapping is complete, CayenneModeler can create mappings of Java classes (aka "ObjEntities") by deriving everything from DbEntities. At present there is no way to do it for the entire DataMap in one click, so we'll do it for each table individually.</p>
+
+<ul>
+	<li>Select "ARTIST" DbEntity and click on "Create ObjEntity" button (a green class icon) either on the entity toolbar or on the main toolbar. An ObjEntity called "Artist" is created with a Java class field set to "cayenne.tutorial.Artist". The modeler transformed the database names to the Java-friendly names (e.g., if you click on the "Attributes" tab, you'll see that "DATE_OF_BIRTH" column was converted to "dateOfBirth" Java class attribute).</li>
+	<li>Select "GALLERY" DbEntity and click on "Create ObjEntity" button again - you'll see a "Gallery" ObjEntity created.</li>
+	<li>Finally, do the same thing for "PAINTING".</li>
+</ul>
+
+
+<p>Now you need to synchronize relationships. Artist and Gallery entities were created when there was no related "Painting" entity, so their relationships were not set. </p>
+
+<ul>
+	<li>Click on the "Artist" ObjEntity and (optinally) change to the "Relationships" tab. Now click on "Sync ObjEntity with DbEntity" button on the toolbar (two yellow arrows) - you will see the "paintings" relationship appear.</li>
+	<li>Do the same for the "Gallery" entity.</li>
+</ul>
+
+
+<p>Unless you want to customize the Java class and property names (which you can do easily) the mapping is complete. </p>
+
+<hr />
+<p><b>Next Step: <a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Java Classes/index.html" title="Tutorial Java Classes">Tutorial Java Classes</a></b></p>
+<hr /></div>
+</div>
+  <div class="clearer">.</div>
+  <div style="height: 12px; background-image: url('../../../../images/border_bottom.gif'); background-repeat: repeat-x;"></div>
+
+  <div class="smalltext copyright">
+    Copyright &copy;2001-2010 Apache Software Foundation
+  </div>
+
+</body>
+</html>

Propchange: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/modeler-artistid.png
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Tutorial/Tutorial%20Object%20Relational%20Mapping/modeler-artistid.png?rev=1034943&view=auto
==============================================================================
Files cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/modeler-artistid.png (added) and cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/modeler-artistid.png Sun Nov 14 07:05:50 2010 differ

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/modeler-dbrelationship.png
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Tutorial/Tutorial%20Object%20Relational%20Mapping/modeler-dbrelationship.png?rev=1034943&view=auto
==============================================================================
Files cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/modeler-dbrelationship.png (added) and cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/modeler-dbrelationship.png Sun Nov 14 07:05:50 2010 differ

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial ObjectContext/index.html
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Tutorial/Tutorial%20ObjectContext/index.html?rev=1034943&view=auto
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial ObjectContext/index.html (added)
+++ cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial ObjectContext/index.html Sun Nov 14 07:05:50 2010
@@ -0,0 +1,158 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+-->
+<html>
+  <head>
+    <title>Apache Cayenne Documentation - Tutorial ObjectContext</title>
+    <style type="text/css">@import "../../../../style.css";</style>
+  </head>
+<body>
+  <div class="header">
+    <div style="float: left;"><a href="http://cayenne.apache.org/"><img src="../../../../images/logo.gif" align="absmiddle" border="0"></a></div>
+    <span class="logoSpaceLink"><a href="../../../../index.html">Cayenne User Documentation</a></span><br />
+    <span class="pagetitle">Tutorial ObjectContext</span>
+  </div>
+<div id="cayenne_toc">
+<ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Introduction/index.html">Introduction</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Installation/index.html">Installation</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/index.html">Tutorial</a><ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Setup/index.html">Tutorial Setup</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/index.html">Tutorial Starting Project</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/index.html">Tutorial Object Relational Mapping</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Java Classes/index.html">Tutorial Java Classes</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial ObjectContext/index.html">Tutorial ObjectContext</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Persistent Objects/index.html">Tutorial Persistent Objects</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial SelectQuery/index.html">Tutorial SelectQuery</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Delete/index.html">Tutorial Delete</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Webapp/index.html">Tutorial Webapp</a></li>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Design/index.html">Design</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/DataContext/index.html">DataContext</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Queries/index.html">Queries</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/DataObjects/index.html">DataObjects</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Stored Procedures/index.html">Stored Procedures</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Expressions/index.html">Expressions</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Lifecycle Callbacks/index.html">Lifecycle Callbacks</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Performance Tuning/index.html">Performance Tuning</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Caching and Fresh Data/index.html">Caching and Fresh Data</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Deployment/index.html">Deployment</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Ant Tasks/index.html">Ant Tasks</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Maven2 Plugins/index.html">Maven2 Plugins</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Customization/index.html">Customization</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent"><p>In this section we'll write a simple main class to run our application, and get a brief introduction to Cayenne ObjectContext.</p>
+
+<h3><a name="TutorialObjectContext-CreatingtheMainClass"></a>Creating the Main Class</h3>
+
+<ul>
+	<li>In Eclipse create a new class called "Main" in the <tt>"org.example.cayenne"</tt> package.</li>
+	<li>Create a standard "main" method to make it a runnable class:</li>
+</ul>
+
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java"><span class="code-keyword">package</span> org.example.cayenne;
+
+<span class="code-keyword">public</span> class Main {
+
+	<span class="code-keyword">public</span> <span class="code-keyword">static</span> void main(<span class="code-object">String</span>[] args) {
+
+	}
+}</pre>
+</div></div>
+
+<ul>
+	<li>The first thing you need to be able to access the database is to create a ServerRuntime object (which is essentially a wrapper around Cayenne stack) and use it to obtain an instance of an <tt>ObjectContext</tt>.</li>
+</ul>
+
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java"><span class="code-keyword">package</span> org.example.cayenne;
+
+<span class="code-keyword">import</span> org.apache.cayenne.ObjectContext;
+<span class="code-keyword">import</span> org.apache.cayenne.access.DataContext;
+
+<span class="code-keyword">public</span> class Main {
+
+	<span class="code-keyword">public</span> <span class="code-keyword">static</span> void main(<span class="code-object">String</span>[] args) {
+                ServerRuntime cayenneRuntime = <span class="code-keyword">new</span> ServerRuntime(
+				<span class="code-quote">"cayenne-UntitledDomain.xml"</span>);
+		ObjectContext context = cayenneRuntime.getContext();
+	}
+}</pre>
+</div></div>
+
+<p>ObjectContext is an isolated "session" in Cayenne that provides all needed API to work with data. ObjectContext has methods to execute queries and manage persistent objects. We'll discuss them in the following sections. When the first ObjectContext is created in the application, Cayenne loads XML mapping files and creates a shared access stack that is later reused by other ObjectContexts. </p>
+
+<h3><a name="TutorialObjectContext-RunningApplication"></a>Running Application</h3>
+
+<p>Let's check what happens when you run the application. But before we do that we need to add another dependency to the <tt>pom.xml</tt> - Apache Derby, our embedded database engine. The following piece of XML needs to be added to the <tt>&lt;dependencies&gt;...&lt;/dependencies&gt;</tt> section, where we already have Cayenne jars:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">&lt;dependency&gt;
+   &lt;groupId&gt;org.apache.derby&lt;/groupId&gt;
+   &lt;artifactId&gt;derby&lt;/artifactId&gt;
+   &lt;version&gt;10.5.3.0_1&lt;/version&gt;
+&lt;/dependency&gt;</pre>
+</div></div>
+
+<p>Now we are ready to run. Right click the "Main" class in Eclipse and select <tt>"Run As &gt; Java Application"</tt>. In the console you'll see output similar to this, indicating that Cayenne stack has been started:</p>
+
+<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
+<pre>INFO: started configuration loading.
+INFO: loaded domain: UntitledDomain
+INFO: loaded &lt;map name='UntitledDomainMap' location='UntitledDomainMap.map.xml'&gt;.
+INFO: loading &lt;node name='UntitledDomainNode' datasource='UntitledDomainNode.driver.xml' 
+factory='org.apache.cayenne.conf.DriverDataSourceFactory' 
+schema-update-strategy='org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy'&gt;.
+INFO: using factory: org.apache.cayenne.conf.DriverDataSourceFactory
+INFO: loading driver information from 'UntitledDomainNode.driver.xml'.
+INFO: loading driver org.apache.derby.jdbc.EmbeddedDriver
+INFO: loading user name and password.
+INFO: Created connection pool: jdbc:derby:memory:testdb;create=true 
+	Driver class: org.apache.derby.jdbc.EmbeddedDriver
+	Min. connections in the pool: 1
+	Max. connections in the pool: 1
+INFO: loaded datasource.
+INFO: no adapter set, using automatic adapter.
+INFO: loaded map-ref: UntitledDomainMap.
+INFO: finished configuration loading in 396 ms.</pre>
+</div></div>
+
+<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="../../../../images/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>How to Configure Cayenne Logging</b><br />You can tweak more or less detailed output by following the instructions in the <a href="../../../../Documentation/Cayenne Guide/Deployment/Configuring Logging/index.html" title="Configuring Logging">logging chapter</a>.</td></tr></table></div>
+
+<p>Nothing much happened here, but we've been able to create a working Cayenne stack. In the following chapters we'll use the ObjectContext for more interesting things.</p>
+
+<hr />
+<p><b>Next Step: <a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Persistent Objects/index.html" title="Tutorial Persistent Objects">Tutorial Persistent Objects</a></b></p>
+<hr /></div>
+</div>
+  <div class="clearer">.</div>
+  <div style="height: 12px; background-image: url('../../../../images/border_bottom.gif'); background-repeat: repeat-x;"></div>
+
+  <div class="smalltext copyright">
+    Copyright &copy;2001-2010 Apache Software Foundation
+  </div>
+
+</body>
+</html>

Propchange: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial ObjectContext/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Persistent Objects/index.html
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Tutorial/Tutorial%20Persistent%20Objects/index.html?rev=1034943&view=auto
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Persistent Objects/index.html (added)
+++ cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Persistent Objects/index.html Sun Nov 14 07:05:50 2010
@@ -0,0 +1,210 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+-->
+<html>
+  <head>
+    <title>Apache Cayenne Documentation - Tutorial Persistent Objects</title>
+    <style type="text/css">@import "../../../../style.css";</style>
+  </head>
+<body>
+  <div class="header">
+    <div style="float: left;"><a href="http://cayenne.apache.org/"><img src="../../../../images/logo.gif" align="absmiddle" border="0"></a></div>
+    <span class="logoSpaceLink"><a href="../../../../index.html">Cayenne User Documentation</a></span><br />
+    <span class="pagetitle">Tutorial Persistent Objects</span>
+  </div>
+<div id="cayenne_toc">
+<ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Introduction/index.html">Introduction</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Installation/index.html">Installation</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/index.html">Tutorial</a><ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Setup/index.html">Tutorial Setup</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/index.html">Tutorial Starting Project</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/index.html">Tutorial Object Relational Mapping</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Java Classes/index.html">Tutorial Java Classes</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial ObjectContext/index.html">Tutorial ObjectContext</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Persistent Objects/index.html">Tutorial Persistent Objects</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial SelectQuery/index.html">Tutorial SelectQuery</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Delete/index.html">Tutorial Delete</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Webapp/index.html">Tutorial Webapp</a></li>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Design/index.html">Design</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/DataContext/index.html">DataContext</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Queries/index.html">Queries</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/DataObjects/index.html">DataObjects</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Stored Procedures/index.html">Stored Procedures</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Expressions/index.html">Expressions</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Lifecycle Callbacks/index.html">Lifecycle Callbacks</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Performance Tuning/index.html">Performance Tuning</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Caching and Fresh Data/index.html">Caching and Fresh Data</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Deployment/index.html">Deployment</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Ant Tasks/index.html">Ant Tasks</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Maven2 Plugins/index.html">Maven2 Plugins</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Customization/index.html">Customization</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent"><p>In this section we'll learn about persistent objects, how to customize them and how to create and save them in DB.</p>
+
+<h3><a name="TutorialPersistentObjects-InspectingandCustomizingPersistentObjects"></a>Inspecting and Customizing Persistent Objects</h3>
+
+<p>Persistent classes in Cayenne implement a <a href="../../../../Documentation/Cayenne Guide/DataObjects/index.html" title="DataObjects">DataObject interface</a>. If you inspect any of the classes <a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Java Classes/index.html" title="Tutorial Java Classes">generated earlier</a> in this tutorial (e.g. <tt>org.example.cayenne.persistent.Artist</tt>), you'll see that it extends a class with the name that starts with underscore (<tt>org.example.cayenne.persistent.auto._Artist</tt>), which in turn extends from <tt>org.apache.cayenne.CayenneDataObject</tt>. Splitting each persistent class into user-customizable subclass (Xyz) and a generated superclass (_Xyz) is a useful technique to avoid overwriting the custom code when refreshing classes from the mapping model.</p>
+
+<p>Let's for instance add a utility method to the Artist class that sets Artist date of birth, taking a string argument for the date. It will be preserved even if the model changes later:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java"><span class="code-keyword">package</span> org.example.cayenne.persistent;
+
+<span class="code-keyword">import</span> java.text.ParseException;
+<span class="code-keyword">import</span> java.text.SimpleDateFormat;
+<span class="code-keyword">import</span> java.util.Date;
+
+<span class="code-keyword">import</span> org.example.cayenne.persistent.auto._Artist;
+
+<span class="code-keyword">public</span> class Artist <span class="code-keyword">extends</span> _Artist {
+
+	<span class="code-keyword">static</span> <span class="code-keyword">final</span> <span class="code-object">String</span> DEFAULT_DATE_FORMAT = <span class="code-quote">"yyyyMMdd"</span>;
+
+	/**
+	 * Sets date of birth using a string in format yyyyMMdd.
+	 */
+	<span class="code-keyword">public</span> void setDateOfBirthString(<span class="code-object">String</span> yearMonthDay) {
+		<span class="code-keyword">if</span> (yearMonthDay == <span class="code-keyword">null</span>) {
+			setDateOfBirth(<span class="code-keyword">null</span>);
+		} <span class="code-keyword">else</span> {
+
+			Date date;
+			<span class="code-keyword">try</span> {
+				date = <span class="code-keyword">new</span> SimpleDateFormat(DEFAULT_DATE_FORMAT)
+						.parse(yearMonthDay);
+			} <span class="code-keyword">catch</span> (ParseException e) {
+				<span class="code-keyword">throw</span> <span class="code-keyword">new</span> IllegalArgumentException(
+				  <span class="code-quote">"A date argument must be in format '"</span>
+				+ DEFAULT_DATE_FORMAT + <span class="code-quote">"': "</span> + yearMonthDay);
+			}
+
+			setDateOfBirth(date);
+		}
+	}
+}</pre>
+</div></div>
+
+
+<h3><a name="TutorialPersistentObjects-CreateNewObjects"></a>Create New Objects</h3>
+
+<p>Now we'll create a bunch of objects and save them to the database. An object is created and registered with ObjectContext using "newObject" method. Objects <b>must</b> be registered with DataContext to be persisted and to allow setting relationships with other objects. Add this code to the "main" method of the Main class:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">Artist picasso = context.newObject(Artist.class);
+picasso.setName(<span class="code-quote">"Pablo Picasso"</span>);
+picasso.setDateOfBirthString(<span class="code-quote">"18811025"</span>);</pre>
+</div></div>
+
+<p>Note that at this point "picasso" object is only stored in memory and is not saved in the database. Let's continue by adding a Metropolitan Museum "Gallery" object and a few Picasso "Paintings":</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">Gallery metropolitan = context.newObject(Gallery.class);
+metropolitan.setName(<span class="code-quote">"Metropolitan Museum of Art"</span>); 
+
+Painting girl = context.newObject(Painting.class);
+girl.setName(<span class="code-quote">"Girl Reading at a Table"</span>);
+        
+Painting stein = context.newObject(Painting.class);
+stein.setName(<span class="code-quote">"Gertrude Stein"</span>);</pre>
+</div></div>
+
+<p>Now we can link the objects together, establishing relationships. Note that in each case below relationships are automatically estabslished in both directions (e.g. <tt>picasso.addToPaintings(girl)</tt> has exactly the same effect as <tt>girl.setToArtist(picasso)</tt>).</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">picasso.addToPaintings(girl);
+picasso.addToPaintings(stein);
+        
+girl.setGallery(metropolitan);
+stein.setGallery(metropolitan);</pre>
+</div></div>
+
+<p>Now lets save all five new objects, in a single method call:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">context.commitChanges();</pre>
+</div></div>
+
+<p>Now you can run the application again as described <a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial ObjectContext/index.html" title="Tutorial ObjectContext">in the previous section</a>. The new output will show a few actual DB operations:</p>
+
+<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
+<pre>Dec 20, 2009 11:11:37 PM org.apache.cayenne.conf.RuntimeLoadDelegate startedLoading
+INFO: started configuration loading.
+... 
+INFO: Opening connection: jdbc:derby:memory:testdb;create=true 
+	Login: null
+	Password: *******
+INFO: +++ Connecting: SUCCESS.
+INFO: --- transaction started.
+INFO: Detected and installed adapter: org.apache.cayenne.dba.derby.DerbyAdapter
+INFO: --- will run 3 queries.
+INFO: No schema detected, will create mapped tables
+INFO: CREATE TABLE ARTIST (DATE_OF_BIRTH DATE, ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY, 
+ NAME VARCHAR (200), PRIMARY KEY (ID))
+INFO: CREATE TABLE GALLERY (ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY, NAME VARCHAR (200), 
+ PRIMARY KEY (ID))
+INFO: CREATE TABLE PAINTING (ARTIST_ID INTEGER, GALLERY_ID INTEGER, ID INTEGER NOT NULL 
+ GENERATED BY DEFAULT AS IDENTITY, NAME VARCHAR (200), PRIMARY KEY (ID))
+INFO: ALTER TABLE PAINTING ADD FOREIGN KEY (ARTIST_ID) REFERENCES ARTIST (ID)
+INFO: ALTER TABLE PAINTING ADD FOREIGN KEY (GALLERY_ID) REFERENCES GALLERY (ID)
+INFO: CREATE TABLE AUTO_PK_SUPPORT (  TABLE_NAME CHAR(100) NOT NULL,  NEXT_ID BIGINT NOT NULL,  
+PRIMARY KEY(TABLE_NAME))
+INFO: DELETE FROM AUTO_PK_SUPPORT WHERE TABLE_NAME IN ('ARTIST', 'GALLERY', 'PAINTING')
+INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('ARTIST', 200)
+INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('GALLERY', 200)
+INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('PAINTING', 200)
+INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'ARTIST']
+INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'GALLERY']
+INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'PAINTING']
+INFO: --- will run 3 queries.
+INFO: INSERT INTO ARTIST (DATE_OF_BIRTH, ID, NAME) VALUES (?, ?, ?)
+INFO: [batch bind: 1-&gt;DATE_OF_BIRTH:'1881-10-25 00:00:00.0', 2-&gt;ID:200, 
+3-&gt;NAME:'Pablo Picasso']
+INFO: === updated 1 row.
+INFO: INSERT INTO GALLERY (ID, NAME) VALUES (?, ?)
+INFO: [batch bind: 1-&gt;ID:200, 2-&gt;NAME:'Metropolitan Museum of Art']
+INFO: === updated 1 row.
+INFO: INSERT INTO PAINTING (ARTIST_ID, GALLERY_ID, ID, NAME) VALUES (?, ?, ?, ?)
+INFO: [batch bind: 1-&gt;ARTIST_ID:200, 2-&gt;GALLERY_ID:200, 3-&gt;ID:200, 
+4-&gt;NAME:'Girl Reading at a Table']
+INFO: [batch bind: 1-&gt;ARTIST_ID:200, 2-&gt;GALLERY_ID:200, 3-&gt;ID:201, 
+4-&gt;NAME:'Gertrude Stein']
+INFO: === updated 2 rows.
+INFO: +++ transaction committed.
+</pre>
+</div></div>
+
+<p>So first Cayenne creates the needed tables (remember, we used "CreateIfNoSchemaStrategy"). Then it runs a number of inserts, generating primary keys on the fly. Not bad for just a few lines of code.</p>
+
+<hr />
+<p><b>Next Step: <a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial SelectQuery/index.html" title="Tutorial SelectQuery">Tutorial SelectQuery</a></b></p>
+<hr /></div>
+</div>
+  <div class="clearer">.</div>
+  <div style="height: 12px; background-image: url('../../../../images/border_bottom.gif'); background-repeat: repeat-x;"></div>
+
+  <div class="smalltext copyright">
+    Copyright &copy;2001-2010 Apache Software Foundation
+  </div>
+
+</body>
+</html>

Propchange: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Persistent Objects/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial SelectQuery/index.html
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Tutorial/Tutorial%20SelectQuery/index.html?rev=1034943&view=auto
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial SelectQuery/index.html (added)
+++ cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial SelectQuery/index.html Sun Nov 14 07:05:50 2010
@@ -0,0 +1,137 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+-->
+<html>
+  <head>
+    <title>Apache Cayenne Documentation - Tutorial SelectQuery</title>
+    <style type="text/css">@import "../../../../style.css";</style>
+  </head>
+<body>
+  <div class="header">
+    <div style="float: left;"><a href="http://cayenne.apache.org/"><img src="../../../../images/logo.gif" align="absmiddle" border="0"></a></div>
+    <span class="logoSpaceLink"><a href="../../../../index.html">Cayenne User Documentation</a></span><br />
+    <span class="pagetitle">Tutorial SelectQuery</span>
+  </div>
+<div id="cayenne_toc">
+<ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Introduction/index.html">Introduction</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Installation/index.html">Installation</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/index.html">Tutorial</a><ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Setup/index.html">Tutorial Setup</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/index.html">Tutorial Starting Project</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/index.html">Tutorial Object Relational Mapping</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Java Classes/index.html">Tutorial Java Classes</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial ObjectContext/index.html">Tutorial ObjectContext</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Persistent Objects/index.html">Tutorial Persistent Objects</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial SelectQuery/index.html">Tutorial SelectQuery</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Delete/index.html">Tutorial Delete</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Webapp/index.html">Tutorial Webapp</a></li>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Design/index.html">Design</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/DataContext/index.html">DataContext</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Queries/index.html">Queries</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/DataObjects/index.html">DataObjects</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Stored Procedures/index.html">Stored Procedures</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Expressions/index.html">Expressions</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Lifecycle Callbacks/index.html">Lifecycle Callbacks</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Performance Tuning/index.html">Performance Tuning</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Caching and Fresh Data/index.html">Caching and Fresh Data</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Deployment/index.html">Deployment</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Ant Tasks/index.html">Ant Tasks</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Maven2 Plugins/index.html">Maven2 Plugins</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Customization/index.html">Customization</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent"><p>This section shows how to select objects from the database using SelectQuery. </p>
+
+<h3><a name="TutorialSelectQuery-IntroducingSelectQuery"></a>Introducing SelectQuery</h3>
+
+<p>It was shown before how to <a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Persistent Objects/index.html" title="Tutorial Persistent Objects">persist new objects</a>. Cayenne <a href="../../../../Documentation/Cayenne Guide/Queries/index.html" title="Queries">queries</a> are used to access already saved objects. The primary query type used for selecting objects is <a href="../../../../Documentation/Cayenne Guide/Queries/SelectQuery/index.html" title="SelectQuery">SelectQuery</a>. It can be mapped in CayenneModeler or created via the API. We'll use the later approach in this section. We don't have too much data in the database yet, but we can still demonstrate the main principles below.</p>
+
+<ul>
+	<li>Select all paintings (the code, and the log output it generates):</li>
+</ul>
+
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">SelectQuery select1 = <span class="code-keyword">new</span> SelectQuery(Painting.class);
+List paintings1 = context.performQuery(select1);</pre>
+</div></div>
+
+<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
+<pre>INFO: SELECT t0.GALLERY_ID, t0.ARTIST_ID, t0.NAME, t0.ID FROM PAINTING t0
+INFO: === returned 2 rows. - took 18 ms.</pre>
+</div></div>
+
+<ul>
+	<li>Select paintings that start with "gi", ignoring case (read more about qualifier Expressions and ExpressionFactory <a href="../../../../Documentation/Cayenne Guide/Expressions/index.html" title="Expressions">here</a>:</li>
+</ul>
+
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">Expression qualifier2 = ExpressionFactory.likeIgnoreCaseExp(
+                Painting.NAME_PROPERTY,
+                <span class="code-quote">"gi%"</span>);
+SelectQuery select2 = <span class="code-keyword">new</span> SelectQuery(Painting.class, qualifier2);
+List paintings2 = context.performQuery(select2);</pre>
+</div></div>
+
+<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
+<pre>INFO: SELECT t0.GALLERY_ID, t0.ARTIST_ID, t0.NAME, t0.ID FROM PAINTING t0 
+WHERE UPPER(t0.NAME) LIKE UPPER(?) [bind: 1-&gt;NAME:'gi%']
+INFO: === returned 1 row. - took 12 ms.</pre>
+</div></div>
+
+<ul>
+	<li>Select all paintings done by artists who were born more than a 100 years ago (demonstrating using Expression.fromString(..) instead of ExpressionFactory):</li>
+</ul>
+
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">Calendar c = <span class="code-keyword">new</span> GregorianCalendar();
+c.set(c.get(Calendar.YEAR) - 100, 0, 1, 0, 0, 0);
+
+Expression qualifier3 = Expression.fromString(<span class="code-quote">"artist.dateOfBirth &lt; $date"</span>);
+qualifier3 = qualifier3.expWithParameters(Collections.singletonMap(<span class="code-quote">"date"</span>, c.getTime()));
+SelectQuery select3 = <span class="code-keyword">new</span> SelectQuery(Painting.class, qualifier3);
+List paintings3 = context.performQuery(select3);</pre>
+</div></div>
+
+<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
+<pre>SELECT t0.GALLERY_ID, t0.ARTIST_ID, t0.NAME, t0.ID FROM PAINTING t0 
+JOIN ARTIST t1 ON (t0.ARTIST_ID = t1.ID) WHERE t1.DATE_OF_BIRTH &lt; ? 
+[bind: 1-&gt;DATE_OF_BIRTH:'1909-01-01 00:00:00.378']
+INFO: === returned 2 rows. - took 19 ms.</pre>
+</div></div>
+
+<hr />
+<p><b>Next Step: <a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Delete/index.html" title="Tutorial Delete">Tutorial Delete</a></b></p>
+<hr /></div>
+</div>
+  <div class="clearer">.</div>
+  <div style="height: 12px; background-image: url('../../../../images/border_bottom.gif'); background-repeat: repeat-x;"></div>
+
+  <div class="smalltext copyright">
+    Copyright &copy;2001-2010 Apache Software Foundation
+  </div>
+
+</body>
+</html>

Propchange: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial SelectQuery/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Setup/index.html
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Tutorial/Tutorial%20Setup/index.html?rev=1034943&view=auto
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Setup/index.html (added)
+++ cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Setup/index.html Sun Nov 14 07:05:50 2010
@@ -0,0 +1,91 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+-->
+<html>
+  <head>
+    <title>Apache Cayenne Documentation - Tutorial Setup</title>
+    <style type="text/css">@import "../../../../style.css";</style>
+  </head>
+<body>
+  <div class="header">
+    <div style="float: left;"><a href="http://cayenne.apache.org/"><img src="../../../../images/logo.gif" align="absmiddle" border="0"></a></div>
+    <span class="logoSpaceLink"><a href="../../../../index.html">Cayenne User Documentation</a></span><br />
+    <span class="pagetitle">Tutorial Setup</span>
+  </div>
+<div id="cayenne_toc">
+<ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Introduction/index.html">Introduction</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Installation/index.html">Installation</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/index.html">Tutorial</a><ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Setup/index.html">Tutorial Setup</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/index.html">Tutorial Starting Project</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Object Relational Mapping/index.html">Tutorial Object Relational Mapping</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Java Classes/index.html">Tutorial Java Classes</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial ObjectContext/index.html">Tutorial ObjectContext</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Persistent Objects/index.html">Tutorial Persistent Objects</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial SelectQuery/index.html">Tutorial SelectQuery</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Delete/index.html">Tutorial Delete</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Webapp/index.html">Tutorial Webapp</a></li>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Design/index.html">Design</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/DataContext/index.html">DataContext</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Queries/index.html">Queries</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/DataObjects/index.html">DataObjects</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Stored Procedures/index.html">Stored Procedures</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Expressions/index.html">Expressions</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Lifecycle Callbacks/index.html">Lifecycle Callbacks</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Performance Tuning/index.html">Performance Tuning</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Caching and Fresh Data/index.html">Caching and Fresh Data</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Deployment/index.html">Deployment</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Ant Tasks/index.html">Ant Tasks</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Maven2 Plugins/index.html">Maven2 Plugins</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Customization/index.html">Customization</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent"><p>The goal of this section of the tutorial is to install (or check that you already have installed) a minimally needed set of software to build a Cayenne application.</p>
+
+<h3><a name="TutorialSetup-InstallJava"></a>Install Java</h3>
+
+<p>Obviously, JDK has to be installed. Cayenne 3.1 requires JDK 1.5 or newer.</p>
+
+<h3><a name="TutorialSetup-InstallEclipseIDEandtheMavenPlugin"></a>Install Eclipse IDE and the Maven Plugin</h3>
+
+<p>Download Eclipse <a href="http://www.eclipse.org/downloads/" class="external-link" rel="nofollow">from here</a>. This tutorial is based on the Galileo package (Eclipse 3.5), JEE edition, still it should work with any recent vanilla Eclipse distribution.</p>
+
+<p>After downloading Eclipse, unpack it somewhere in the filesystem, and start it. The only plugin that you need for the tutorial is <a href="http://m2eclipse.sonatype.org/" class="external-link" rel="nofollow">m2eclipse</a>. To install it, in Eclipse go to "Help &gt; Install New Software", then click on "Add.." to add a new download site, and enter "Maven" in the "Name" field, and "http://m2eclipse.sonatype.org/sites/m2e" in the "Location" field. You may install any of the optional components that you think you need, but for this tutorial we only select a few basic components as shown on the following screenshot:</p>
+
+<p><span class="image-wrap" style=""><img src="maven-plugin-install.png?version=1&amp;modificationDate=1289713231089" style="border: 0px solid black" /></span></p>
+
+<p>From here follow the Eclipse dialog instructions to finish the installation.</p>
+
+<hr />
+<p><b>Next Step: <a href="../../../../Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/index.html" title="Tutorial Starting Project">Tutorial Starting Project</a></b></p>
+<hr /></div>
+</div>
+  <div class="clearer">.</div>
+  <div style="height: 12px; background-image: url('../../../../images/border_bottom.gif'); background-repeat: repeat-x;"></div>
+
+  <div class="smalltext copyright">
+    Copyright &copy;2001-2010 Apache Software Foundation
+  </div>
+
+</body>
+</html>

Propchange: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Setup/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Setup/maven-plugin-install.png
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Tutorial/Tutorial%20Setup/maven-plugin-install.png?rev=1034943&view=auto
==============================================================================
Files cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Setup/maven-plugin-install.png (added) and cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Setup/maven-plugin-install.png Sun Nov 14 07:05:50 2010 differ

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/base-datamap.png
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Tutorial/Tutorial%20Starting%20Project/base-datamap.png?rev=1034943&view=auto
==============================================================================
Files cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/base-datamap.png (added) and cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/base-datamap.png Sun Nov 14 07:05:50 2010 differ

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/base-datanode.png
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Tutorial/Tutorial%20Starting%20Project/base-datanode.png?rev=1034943&view=auto
==============================================================================
Files cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/base-datanode.png (added) and cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/base-datanode.png Sun Nov 14 07:05:50 2010 differ

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/eclipse-xmlfiles.png
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Tutorial/Tutorial%20Starting%20Project/eclipse-xmlfiles.png?rev=1034943&view=auto
==============================================================================
Files cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/eclipse-xmlfiles.png (added) and cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Tutorial/Tutorial Starting Project/eclipse-xmlfiles.png Sun Nov 14 07:05:50 2010 differ