cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r554413 [12/17] - in /cayenne/main/trunk/docs/doc/src/main/resources/doc: ./ Documentation/ Documentation/Cayenne Guide/ Documentation/Cayenne Guide/Ant Tasks/ Documentation/Cayenne Guide/Ant Tasks/cdataport/ Documentation/Cayenne Guide/Ant...
Date Sun, 08 Jul 2007 19:11:53 GMT
Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial DataContext/index.html
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Quick%20Start/Tutorial%20DataContext/index.html?view=auto&rev=554413
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial DataContext/index.html (added)
+++ cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial DataContext/index.html Sun Jul  8 12:11:31 2007
@@ -0,0 +1,128 @@
+<!--
+   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 DataContext</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 DataContext</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/Quick Start/index.html">Quick Start</a><ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Setup/index.html">Tutorial Setup</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Starting Mapping Project/index.html">Tutorial Starting Mapping Project</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Object Relational Mapping/index.html">Tutorial Object Relational Mapping</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Generate Database and Java Classes/index.html">Tutorial Generate Database and Java Classes</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataContext/index.html">Tutorial DataContext</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataObjects/index.html">Tutorial DataObjects</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Mapping Query/index.html">Tutorial Mapping Query</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial SelectQuery/index.html">Tutorial SelectQuery</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Delete/index.html">Tutorial Delete</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/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>
+<li><a href="../../../../Documentation/Cayenne Guide/DataViews/index.html">DataViews</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent"><ul>
+	<li>In Eclipse create a new class called "Main" in the <tt>"cayenne.tutorial"</tt> package.</li>
+	<li>Create a standard "main" method to make it a runnable class:</li>
+</ul>
+
+
+<div class="code"><div class="codeHeader"><b>Main.java</b></div><div class="codeContent">
+<pre class="code-java"><span class="code-keyword">package</span> cayenne.tutorial;
+
+<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 a <tt><a href="../../../../Documentation/Cayenne Guide/DataContext/index.html" title="DataContext">DataContext</a></tt> instance. In this simple case of a standalone command line application, it can be obtained by calling a static method:</li>
+</ul>
+
+
+<div class="code"><div class="codeHeader"><b>Main.java</b></div><div class="codeContent">
+<pre class="code-java"><span class="code-keyword">package</span> cayenne.tutorial;
+
+<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) {
+
+		DataContext context = DataContext.createDataContext();
+	}
+}</pre>
+</div></div>
+
+<p>DataContext is a single session a user needs to work with Cayenne. DataContext has methods to execute queries and manage persistent objects. We'll discuss them in the following chapters. When the first DataContext is created in the application, Cayenne loads XML mapping files and creates an access stack that can later be reused for other DataContexts. </p>
+
+<h3><a name="TutorialDataContext-RunningApplication"></a>Running Application</h3>
+
+<p>Let's check what happens when you run the application. First you need to close CayenneModeler (as Derby does not allow multiple applications accessing the same database in the embedded mode). After that 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"><div class="preformattedContent">
+<pre>INFO  QueryLogger: Created connection pool: jdbc:derby:testdb;create=true
+	Driver class: org.apache.derby.jdbc.EmbeddedDriver
+	Min. connections in the pool: 1
+	Max. connections in the pool: 1</pre>
+</div></div>
+
+<p>The log omits most stack loading details. You can configure a more detailed output by following the instructions in the <a href="../../../../Documentation/Cayenne Guide/Deployment/Configuring Logging/index.html" title="Configuring Logging">logging chapter</a>.</p>
+
+<hr />
+<p><b>Next Step: <a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataObjects/index.html" title="Tutorial DataObjects">Tutorial DataObjects</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-2007 Apache Software Foundation
+  </div>
+
+</body>
+</html>

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

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial DataObjects/index.html
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Quick%20Start/Tutorial%20DataObjects/index.html?view=auto&rev=554413
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial DataObjects/index.html (added)
+++ cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial DataObjects/index.html Sun Jul  8 12:11:31 2007
@@ -0,0 +1,193 @@
+<!--
+   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 DataObjects</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 DataObjects</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/Quick Start/index.html">Quick Start</a><ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Setup/index.html">Tutorial Setup</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Starting Mapping Project/index.html">Tutorial Starting Mapping Project</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Object Relational Mapping/index.html">Tutorial Object Relational Mapping</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Generate Database and Java Classes/index.html">Tutorial Generate Database and Java Classes</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataContext/index.html">Tutorial DataContext</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataObjects/index.html">Tutorial DataObjects</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Mapping Query/index.html">Tutorial Mapping Query</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial SelectQuery/index.html">Tutorial SelectQuery</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Delete/index.html">Tutorial Delete</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/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>
+<li><a href="../../../../Documentation/Cayenne Guide/DataViews/index.html">DataViews</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent"><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 classes <a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Generate Database and Java Classes/index.html" title="Tutorial Generate Database and Java Classes">generated earlier</a> in this tutorial (e.g. <tt>cayenne.tutorial.Artist</tt>), you'll see that it extends a class with the name that starts with underscore (<tt>cayenne.tutorial.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 of the custom code when refreshing classes from the mapping model.</p>
+
+<p>Let's add a utility method to the Artist class that sets Artist date of birth, taking a string argument for the date:</p>
+<div class="code"><div class="codeHeader"><b>Artist.java</b></div><div class="codeContent">
+<pre class="code-java"><span class="code-keyword">package</span> cayenne.tutorial;
+
+<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> cayenne.tutorial.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>
+
+
+<p>We'll continue by creating a bunch of new objects and saving them to the database.</p>
+
+<p>An object is created and registered with DataContext using "newObject" method. (Note that objects must be registered with DataContext to be persisted and to allow relationships with other objects.) Add this code to the "main" method:</p>
+
+<div class="code"><div class="codeHeader"><b>Main.java</b></div><div class="codeContent">
+<pre class="code-java">Artist picasso = (Artist) 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 teh database. Let's continue by adding a Metropolitan Museum gallery object and a few Picasso paintings:</p>
+
+<div class="code"><div class="codeHeader"><b>Main.java</b></div><div class="codeContent">
+<pre class="code-java">Gallery metropolitan = (Gallery) context.newObject(Gallery.class);
+metropolitan.setName(<span class="code-quote">"Metropolitan Museum of Art"</span>); 
+
+Painting girl = (Painting) context.newObject(Painting.class);
+girl.setName(<span class="code-quote">"Girl Reading at a Table"</span>);
+        
+Painting stein = (Painting) 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"><div class="codeHeader"><b>Main.java</b></div><div class="codeContent">
+<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:</p>
+
+<div class="code"><div class="codeHeader"><b>Main.java</b></div><div class="codeContent">
+<pre class="code-java">context.commitChanges();</pre>
+</div></div>
+
+<p>Now you can run the application again as described <a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataContext/index.html" title="Tutorial DataContext">here</a>. The new output will look like this:</p>
+
+<div class="preformatted"><div class="preformattedContent">
+<pre>INFO  QueryLogger: Created connection pool: jdbc:derby:/Users/andrus/Desktop/testdb;create=true
+	Driver class: org.apache.derby.jdbc.EmbeddedDriver
+	Min. connections in the pool: 1
+	Max. connections in the pool: 1
+INFO  QueryLogger: Opening connection: jdbc:derby:/Users/andrus/Desktop/testdb;create=true
+	Login: null
+	Password: *******
+INFO  QueryLogger: +++ Connecting: SUCCESS.
+INFO  QueryLogger: Detected and installed adapter: org.apache.cayenne.dba.derby.DerbyAdapter
+INFO  QueryLogger: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 'GALLERY']
+INFO  QueryLogger: --- transaction started.
+INFO  QueryLogger: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 'ARTIST']
+INFO  QueryLogger: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 'PAINTING']
+INFO  QueryLogger: --- will run 3 queries.
+INFO  QueryLogger: INSERT INTO GALLERY (ID, NAME) VALUES (?, ?)
+INFO  QueryLogger: [bind: 200, 'Metropolitan Museum of Art']
+INFO  QueryLogger: === updated 1 row.
+INFO  QueryLogger: INSERT INTO ARTIST (DATE_OF_BIRTH, ID, NAME) VALUES (?, ?, ?)
+INFO  QueryLogger: [bind: '1881-10-25 00:00:00.0', 200, 'Pablo Picasso']
+INFO  QueryLogger: === updated 1 row.
+INFO  QueryLogger: INSERT INTO PAINTING (ARTIST_ID, GALLERY_ID, ID, NAME) VALUES (?, ?, ?, ?)
+INFO  QueryLogger: [bind: 200, 200, 200, 'Girl Reading at a Table']
+INFO  QueryLogger: === updated 1 row.
+INFO  QueryLogger: [bind: 200, 200, 201, 'Gertrude Stein']
+INFO  QueryLogger: === updated 1 row.
+INFO  QueryLogger: +++ transaction committed.
+</pre>
+</div></div>
+
+<p>The first few SELECT's are done by Cayenne primary key generator (note that we did not assign any explicit PKs to the objects - Cayenne does this automatically). Following them are the statements generated to save the objects that we created.</p>
+
+<hr />
+<p><b>Next Step: <a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Mapping Query/index.html" title="Tutorial Mapping Query">Tutorial Mapping Query</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-2007 Apache Software Foundation
+  </div>
+
+</body>
+</html>

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

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Delete/delete-rule.jpg
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Quick%20Start/Tutorial%20Delete/delete-rule.jpg?view=auto&rev=554413
==============================================================================
Binary file - no diff available.

Propchange: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Delete/delete-rule.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Delete/index.html
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Quick%20Start/Tutorial%20Delete/index.html?view=auto&rev=554413
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Delete/index.html (added)
+++ cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Delete/index.html Sun Jul  8 12:11:31 2007
@@ -0,0 +1,130 @@
+<!--
+   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/Quick Start/index.html">Quick Start</a><ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Setup/index.html">Tutorial Setup</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Starting Mapping Project/index.html">Tutorial Starting Mapping Project</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Object Relational Mapping/index.html">Tutorial Object Relational Mapping</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Generate Database and Java Classes/index.html">Tutorial Generate Database and Java Classes</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataContext/index.html">Tutorial DataContext</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataObjects/index.html">Tutorial DataObjects</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Mapping Query/index.html">Tutorial Mapping Query</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial SelectQuery/index.html">Tutorial SelectQuery</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Delete/index.html">Tutorial Delete</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/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>
+<li><a href="../../../../Documentation/Cayenne Guide/DataViews/index.html">DataViews</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent">
+<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>
+
+<ul>
+	<li>In the Modeler go to "Artist" ObjEntity, "Relationships" tab and select "Cascade" for the "paintings" relationship delete rule:</li>
+</ul>
+
+
+<p><img src="delete-rule.jpg" align="absmiddle" border="0" /></p>
+
+<ul>
+	<li>Repeat this step for Gallery (set "paintings" relationship to be "Cascade")</li>
+	<li>Repeat this step for Painting (set both relationships rules to "Nullify").</li>
+	<li>Save the mapping, and refresh the porject in Eclispe.</li>
+</ul>
+
+
+<ul>
+	<li>To delete an object we first need to get a hold of this object. Let's use utility class DataObjectUtils to find an artist:</li>
+</ul>
+
+
+<div class="code"><div class="codeHeader"><b>Main.java</b></div><div class="codeContent">
+<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) DataObjectUtils.objectForQuery(context, select);</pre>
+</div></div>
+
+<p>Now let's delete the artist:</p>
+<div class="code"><div class="codeHeader"><b>Main.java</b></div><div class="codeContent">
+<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"><div class="preformattedContent">
+<pre>INFO  QueryLogger: --- will run 2 queries.
+INFO  QueryLogger: --- transaction started.
+INFO  QueryLogger: DELETE FROM PAINTING WHERE ID = ?
+INFO  QueryLogger: [bind: 361]
+INFO  QueryLogger: === updated 1 row.
+INFO  QueryLogger: [bind: 360]
+INFO  QueryLogger: === updated 1 row.
+INFO  QueryLogger: DELETE FROM ARTIST WHERE ID = ?
+INFO  QueryLogger: [bind: 360]
+INFO  QueryLogger: === updated 1 row.
+INFO  QueryLogger: +++ transaction committed.</pre>
+</div></div>
+
+<hr />
+<p><b>Next Step: <a href="../../../../Documentation/Cayenne Guide/Quick Start/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-2007 Apache Software Foundation
+  </div>
+
+</body>
+</html>

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

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Generate Database and Java Classes/class-generator.jpg
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Quick%20Start/Tutorial%20Generate%20Database%20and%20Java%20Classes/class-generator.jpg?view=auto&rev=554413
==============================================================================
Binary file - no diff available.

Propchange: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Generate Database and Java Classes/class-generator.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Generate Database and Java Classes/db-generator.jpg
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Quick%20Start/Tutorial%20Generate%20Database%20and%20Java%20Classes/db-generator.jpg?view=auto&rev=554413
==============================================================================
Binary file - no diff available.

Propchange: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Generate Database and Java Classes/db-generator.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Generate Database and Java Classes/eclipse-classes.jpg
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Quick%20Start/Tutorial%20Generate%20Database%20and%20Java%20Classes/eclipse-classes.jpg?view=auto&rev=554413
==============================================================================
Binary file - no diff available.

Propchange: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Generate Database and Java Classes/eclipse-classes.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Generate Database and Java Classes/index.html
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Quick%20Start/Tutorial%20Generate%20Database%20and%20Java%20Classes/index.html?view=auto&rev=554413
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Generate Database and Java Classes/index.html (added)
+++ cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Generate Database and Java Classes/index.html Sun Jul  8 12:11:31 2007
@@ -0,0 +1,117 @@
+<!--
+   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 Generate Database and 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 Generate Database and 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/Quick Start/index.html">Quick Start</a><ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Setup/index.html">Tutorial Setup</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Starting Mapping Project/index.html">Tutorial Starting Mapping Project</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Object Relational Mapping/index.html">Tutorial Object Relational Mapping</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Generate Database and Java Classes/index.html">Tutorial Generate Database and Java Classes</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataContext/index.html">Tutorial DataContext</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataObjects/index.html">Tutorial DataObjects</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Mapping Query/index.html">Tutorial Mapping Query</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial SelectQuery/index.html">Tutorial SelectQuery</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Delete/index.html">Tutorial Delete</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/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>
+<li><a href="../../../../Documentation/Cayenne Guide/DataViews/index.html">DataViews</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent">
+<p>CayenneModeler can be used to generate both database schema and Java classes from the single XML model. Very often the database already exists and is maintained independently (e.g., by a DBA). In this case you won't have to go through the first part of this procedure.</p>
+
+<h3><a name="TutorialGenerateDatabaseandJavaClasses-CreatingtheDatabase"></a>Creating the Database</h3>
+
+<ul>
+	<li>Click on the DataMap node on the left and then select <tt>"Tools &gt; Create Database Schema"</tt> from the menu. A connection dialog pops up with fields prefilled with the data you entered for the DataNode.</li>
+</ul>
+
+
+<ul>
+	<li>Leave it unchanged and click "Continue" - this will open a dialog with a SQL script and several generation options.</li>
+</ul>
+
+
+<ul>
+	<li>Leave the defaults on ("Create Tables", "Create FK Support", "Create Primary Key Support") and click "Generate" - the database with the tables mapped during previous steps will be created in the specified location. Since Derby uses a filesystem directory for the database, you can actually navigate to it and see that the database is there.</li>
+</ul>
+
+
+<p><img src="db-generator.jpg" align="absmiddle" border="0" /></p>
+
+<h3><a name="TutorialGenerateDatabaseandJavaClasses-CreatingtheJavaClasses"></a>Creating the Java Classes</h3>
+
+<ul>
+	<li>Now 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 "cayenne-tutorial/src" directory of your Eclipse project</li>
+	<li>Click "Generate"</li>
+</ul>
+
+
+<p><img src="class-generator.jpg" align="absmiddle" border="0" /></p>
+
+<p>Note that often you start by generating classes from the Modeler, but at the later stages of the project the generation is usually automated via <a href="../../../../Documentation/Cayenne Guide/Ant Tasks/cgen/index.html" title="cgen">Ant cgen task</a>. Both methods are interchangeable.</p>
+
+<p>Now go back to Eclipse, right click on "cayenne-tutorial" project and select "Refresh" - you should see a pair of classes generated for each mapped entity. Note that you should not modify the classes whose names start with "_" (underscore), as they will be replaced on subsequent generator runs. Instead all custom logic should be placed in their subclasses located in <tt>"cayenne.tutorial"</tt> package - those will never be overwritten by the class generator.</p>
+
+<p><img src="eclipse-classes.jpg" align="absmiddle" border="0" /></p>
+
+<hr />
+<p><b>Next Step: <a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataContext/index.html" title="Tutorial DataContext">Tutorial DataContext</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-2007 Apache Software Foundation
+  </div>
+
+</body>
+</html>

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

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Mapping Query/index.html
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Quick%20Start/Tutorial%20Mapping%20Query/index.html?view=auto&rev=554413
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Mapping Query/index.html (added)
+++ cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Mapping Query/index.html Sun Jul  8 12:11:31 2007
@@ -0,0 +1,140 @@
+<!--
+   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 Mapping Query</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 Mapping Query</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/Quick Start/index.html">Quick Start</a><ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Setup/index.html">Tutorial Setup</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Starting Mapping Project/index.html">Tutorial Starting Mapping Project</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Object Relational Mapping/index.html">Tutorial Object Relational Mapping</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Generate Database and Java Classes/index.html">Tutorial Generate Database and Java Classes</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataContext/index.html">Tutorial DataContext</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataObjects/index.html">Tutorial DataObjects</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Mapping Query/index.html">Tutorial Mapping Query</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial SelectQuery/index.html">Tutorial SelectQuery</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Delete/index.html">Tutorial Delete</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/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>
+<li><a href="../../../../Documentation/Cayenne Guide/DataViews/index.html">DataViews</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent">
+<p>Now that we've got a feel of how <a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataContext/index.html" title="Tutorial DataContext">DataContext works</a> and how to <a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataObjects/index.html" title="Tutorial DataObjects">create and save objects</a>, let's take a small diversion and implement a piece of code that will delete all data from the database every time the tutorial application is started. We'll learn how to map a raw SQL query with parameters using the modeler and then execute it in the code.</p>
+
+<ul>
+	<li>Open CayenneModeler, go to <tt>"File &gt; Recent Files"</tt> and choose the tutorial mapping file.</li>
+	<li>When the project opens, select the DataMap, and click on "Create Query" button (or select "<tt>Project &gt; Create Query</tt>" from the menu).</li>
+	<li>For the query type select "Raw SQL" and click "Create".</li>
+	<li>For "Query Name" enter "DeleteAll" - this will be the key used to reference query later in the code:</li>
+</ul>
+
+
+<p><img src="sql-template.jpg" align="absmiddle" border="0" /></p>
+
+<p>Ignore "Select Properties" settings as the query will not select anything. Rather it will delete all rows from the table with name specified as a parameter.  </p>
+
+<ul>
+	<li>Go to "SQL Scripts" tab and enter the following in the right panel:</li>
+</ul>
+
+
+<div class="preformatted"><div class="preformattedContent">
+<pre>delete from $table</pre>
+</div></div>
+
+<p>Note that "$table" is a variable that will be dynamically substituted by Cayenne in runtime with the table name. (Detailed discussion of SQLTemplate scripting options is provided <a href="../../../../Documentation/Cayenne Guide/Queries/SQLTemplate Query/Scripting SQLTemplate/index.html" title="Scripting SQLTemplate">here</a>).</p>
+
+<ul>
+	<li>Query mapping is complete. Save the project in the Modeler and go back to Eclipse.</li>
+	<li>In Eclipse, refresh the mapping by right-clicking on cayenne-tutorial project and selecting "Refresh".</li>
+	<li>Now add the following code inserting it after the DataContext creation line and before any other code:</li>
+</ul>
+
+
+<div class="code"><div class="codeHeader"><b>Main.java</b></div><div class="codeContent">
+<pre class="code-java">QueryChain chain = <span class="code-keyword">new</span> QueryChain();
+chain.addQuery(<span class="code-keyword">new</span> NamedQuery(<span class="code-quote">"DeleteAll"</span>, Collections.singletonMap(
+                <span class="code-quote">"table"</span>,
+                <span class="code-quote">"PAINTING"</span>)));
+chain.addQuery(<span class="code-keyword">new</span> NamedQuery(<span class="code-quote">"DeleteAll"</span>, Collections.singletonMap(
+                <span class="code-quote">"table"</span>,
+                <span class="code-quote">"ARTIST"</span>)));
+chain.addQuery(<span class="code-keyword">new</span> NamedQuery(<span class="code-quote">"DeleteAll"</span>, Collections.singletonMap(
+                <span class="code-quote">"table"</span>,
+                <span class="code-quote">"GALLERY"</span>)));
+
+context.performGenericQuery(chain);</pre>
+</div></div>
+
+<p>Note that since we need to run the same query three times with different sets of parameters, first we created a <tt><a href="../../../../Documentation/Cayenne Guide/Queries/QueryChain/index.html" title="QueryChain">QueryChain</a></tt> that can hold other queries. Then we added three <tt><a href="../../../../Documentation/Cayenne Guide/Queries/NamedQuery/index.html" title="NamedQuery">NamedQueries</a></tt> (the order is important - painting has to be deleted before artist or gallery due to the foreign key constraints). NamedQuery is a query that is a reference to another query mapped via CayenneModeler (in this case - a query called "DeleteAll" that we mapped above).</p>
+
+<p>Now we can re-run the application and see the following output in the beginning of the log:</p>
+
+<div class="preformatted"><div class="preformattedContent">
+<pre>INFO  QueryLogger: delete from PAINTING
+INFO  QueryLogger: === updated 2 rows.
+INFO  QueryLogger: delete from ARTIST
+INFO  QueryLogger: === updated 1 row.
+INFO  QueryLogger: delete from GALLERY
+INFO  QueryLogger: === updated 1 row.</pre>
+</div></div>
+
+<p>Note that raw sql queries above (aka <a href="../../../../Documentation/Cayenne Guide/Queries/SQLTemplate Query/index.html" title="SQLTemplate Query">SQLTemplates</a>) are run directly against the database bypassing Cayenne object layer. If instead of bulk delete you needed to delete individual objects, you should do so using <tt>DataContext.deleteObject(..)</tt> as discussed <a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Delete/index.html" title="Tutorial Delete">here</a>.</p>
+
+<hr />
+<p><b>Next Step: <a href="../../../../Documentation/Cayenne Guide/Quick Start/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-2007 Apache Software Foundation
+  </div>
+
+</body>
+</html>

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

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Mapping Query/sql-template.jpg
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Quick%20Start/Tutorial%20Mapping%20Query/sql-template.jpg?view=auto&rev=554413
==============================================================================
Binary file - no diff available.

Propchange: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Mapping Query/sql-template.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/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/Quick%20Start/Tutorial%20Object%20Relational%20Mapping/database-schema.jpg?view=auto&rev=554413
==============================================================================
Binary file - no diff available.

Propchange: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Object Relational Mapping/database-schema.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Object Relational Mapping/index.html
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Quick%20Start/Tutorial%20Object%20Relational%20Mapping/index.html?view=auto&rev=554413
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Object Relational Mapping/index.html (added)
+++ cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Object Relational Mapping/index.html Sun Jul  8 12:11:31 2007
@@ -0,0 +1,134 @@
+<!--
+   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/Quick Start/index.html">Quick Start</a><ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Setup/index.html">Tutorial Setup</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Starting Mapping Project/index.html">Tutorial Starting Mapping Project</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Object Relational Mapping/index.html">Tutorial Object Relational Mapping</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Generate Database and Java Classes/index.html">Tutorial Generate Database and Java Classes</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataContext/index.html">Tutorial DataContext</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataObjects/index.html">Tutorial DataObjects</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Mapping Query/index.html">Tutorial Mapping Query</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial SelectQuery/index.html">Tutorial SelectQuery</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Delete/index.html">Tutorial Delete</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/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>
+<li><a href="../../../../Documentation/Cayenne Guide/DataViews/index.html">DataViews</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent">
+<p>Lets go back to CayenneModeler where we have the newly created project open. Our goal is to map the following schema:</p>
+
+<p><img src="database-schema.jpg" align="absmiddle" border="0" /></p>
+
+<h3><a name="TutorialObjectRelationalMapping-MappingDatabaseTables"></a>Mapping Database Tables</h3>
+
+<p>Start by adding the ARTIST table. Mapped database tables are called "DbEntities" in Cayenne. Click on "Create DbEntity" button (or use <tt>"Project &gt; Create DbEntity"</tt> menu). In "DbEntity Name" field enter "ARTIST". Then click on "Create Attribute" button on the entity toolbar (second button on the right). 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><img src="modeler-artistid.jpg" align="absmiddle" border="0" /></p>
+
+<p>Similarly add NAME VARCHAR and DATE_OF_BIRTH DATE attributes. </p>
+
+<p>Repeat this procedure for PAINTING and GALLERY entities.</p>
+
+<p><img src="modeler-gallery.jpg" align="absmiddle" border="0" /></p>
+
+<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 - 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><img src="modeler-dbrel-dialog.jpg" align="absmiddle" border="0" /></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 vice versa. Still you may have noticed one glitch - "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>Do the same thing again for "PAINTING".<br/>
+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. </li>
+	<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/Quick Start/Tutorial Generate Database and Java Classes/index.html" title="Tutorial Generate Database and Java Classes">Tutorial Generate Database and 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-2007 Apache Software Foundation
+  </div>
+
+</body>
+</html>

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

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Object Relational Mapping/modeler-artistid.jpg
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Quick%20Start/Tutorial%20Object%20Relational%20Mapping/modeler-artistid.jpg?view=auto&rev=554413
==============================================================================
Binary file - no diff available.

Propchange: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Object Relational Mapping/modeler-artistid.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Object Relational Mapping/modeler-dbrel-dialog.jpg
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Quick%20Start/Tutorial%20Object%20Relational%20Mapping/modeler-dbrel-dialog.jpg?view=auto&rev=554413
==============================================================================
Binary file - no diff available.

Propchange: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Object Relational Mapping/modeler-dbrel-dialog.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Object Relational Mapping/modeler-gallery.jpg
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Quick%20Start/Tutorial%20Object%20Relational%20Mapping/modeler-gallery.jpg?view=auto&rev=554413
==============================================================================
Binary file - no diff available.

Propchange: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Object Relational Mapping/modeler-gallery.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial SelectQuery/index.html
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Quick%20Start/Tutorial%20SelectQuery/index.html?view=auto&rev=554413
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial SelectQuery/index.html (added)
+++ cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial SelectQuery/index.html Sun Jul  8 12:11:31 2007
@@ -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/Quick Start/index.html">Quick Start</a><ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Setup/index.html">Tutorial Setup</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Starting Mapping Project/index.html">Tutorial Starting Mapping Project</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Object Relational Mapping/index.html">Tutorial Object Relational Mapping</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Generate Database and Java Classes/index.html">Tutorial Generate Database and Java Classes</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataContext/index.html">Tutorial DataContext</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataObjects/index.html">Tutorial DataObjects</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Mapping Query/index.html">Tutorial Mapping Query</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial SelectQuery/index.html">Tutorial SelectQuery</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Delete/index.html">Tutorial Delete</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/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>
+<li><a href="../../../../Documentation/Cayenne Guide/DataViews/index.html">DataViews</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent">
+<p>It was shown before how to <a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataObjects/index.html" title="Tutorial DataObjects">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 similar to how the SQLTemplate <a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Mapping Query/index.html" title="Tutorial Mapping Query">was mapped</a>, in this chapter however we'll show how to create it using Cayenne API.</p>
+
+<p>We don't have too much data in the database yet, but we can still demonstrate the main principles:</p>
+
+<ul>
+	<li>Select all paintings (the code, and the log output it generates):</li>
+</ul>
+
+
+<div class="code"><div class="codeHeader"><b>Main.java</b></div><div class="codeContent">
+<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"><div class="preformattedContent">
+<pre>INFO  QueryLogger: SELECT t0.NAME, t0.ARTIST_ID, t0.GALLERY_ID, t0.ID FROM PAINTING t0
+INFO  QueryLogger: === returned 2 rows. - took 20 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"><div class="codeHeader"><b>Main.java</b></div><div class="codeContent">
+<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"><div class="preformattedContent">
+<pre>INFO  QueryLogger: SELECT t0.NAME, t0.ARTIST_ID, t0.GALLERY_ID, t0.ID FROM PAINTING t0 
+                             WHERE UPPER(t0.NAME) LIKE UPPER(?) [bind: 'gi%']
+INFO  QueryLogger: === returned 1 row. - took 28 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"><div class="codeHeader"><b>Main.java</b></div><div class="codeContent">
+<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"><div class="preformattedContent">
+<pre>INFO  QueryLogger: SELECT t0.NAME, t0.ARTIST_ID, t0.GALLERY_ID, t0.ID FROM PAINTING t0, ARTIST t1 
+                             WHERE t0.ARTIST_ID = t1.ID AND (t1.DATE_OF_BIRTH &lt; ?) [bind: '1906-01-01 00:00:00.3']
+INFO  QueryLogger: === returned 2 rows. - took 31 ms.</pre>
+</div></div>
+
+<hr />
+<p><b>Next Step: <a href="../../../../Documentation/Cayenne Guide/Quick Start/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-2007 Apache Software Foundation
+  </div>
+
+</body>
+</html>

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

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Setup/eclipse-java-settings.jpg
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Quick%20Start/Tutorial%20Setup/eclipse-java-settings.jpg?view=auto&rev=554413
==============================================================================
Binary file - no diff available.

Propchange: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Setup/eclipse-java-settings.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Setup/eclipse-new-project.jpg
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Quick%20Start/Tutorial%20Setup/eclipse-new-project.jpg?view=auto&rev=554413
==============================================================================
Binary file - no diff available.

Propchange: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Setup/eclipse-new-project.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Setup/eclipse-project-settings.jpg
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Quick%20Start/Tutorial%20Setup/eclipse-project-settings.jpg?view=auto&rev=554413
==============================================================================
Binary file - no diff available.

Propchange: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Setup/eclipse-project-settings.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Setup/index.html
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Quick%20Start/Tutorial%20Setup/index.html?view=auto&rev=554413
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Setup/index.html (added)
+++ cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Setup/index.html Sun Jul  8 12:11:31 2007
@@ -0,0 +1,114 @@
+<!--
+   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/Quick Start/index.html">Quick Start</a><ul>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Setup/index.html">Tutorial Setup</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Starting Mapping Project/index.html">Tutorial Starting Mapping Project</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Object Relational Mapping/index.html">Tutorial Object Relational Mapping</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Generate Database and Java Classes/index.html">Tutorial Generate Database and Java Classes</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataContext/index.html">Tutorial DataContext</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial DataObjects/index.html">Tutorial DataObjects</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Mapping Query/index.html">Tutorial Mapping Query</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial SelectQuery/index.html">Tutorial SelectQuery</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Delete/index.html">Tutorial Delete</a></li>
+<li><a href="../../../../Documentation/Cayenne Guide/Quick Start/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>
+<li><a href="../../../../Documentation/Cayenne Guide/DataViews/index.html">DataViews</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent"><h3><a name="TutorialSetup-InstallJava"></a>Install Java</h3>
+
+<p>Make sure you have Java installed (JDK 1.4 or 1.5).</p>
+
+<h3><a name="TutorialSetup-DownloadCayenne"></a>Download Cayenne</h3>
+
+<p>Get <span class="nobr"><a href="http://cayenne.apache.org/download.html" title="Visit page outside Confluence" rel="nofollow">the latest Cayenne<sup><img class="rendericon" src="../../../../images/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"/></sup></a></span> distribution. If you are on Linux, select a cross-platform version (<tt>cayenne-XXX.tar.gz</tt>).  For Mac OS X select <tt>cayenne-XXX-macosx.dmg</tt> and for Windows - <tt>cayenne-XXX-win.zip</tt>. Unpack the distribution somewhere in the file system. </p>
+
+<h3><a name="TutorialSetup-DownloadDerbyDatabase"></a>Download Derby Database</h3>
+
+<p>Get Derby database <span class="nobr"><a href="http://db.apache.org/derby/derby_downloads.html" title="Visit page outside Confluence" rel="nofollow">from here<sup><img class="rendericon" src="../../../../images/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"/></sup></a></span> and unpack it somewhere in the filesystem.</p>
+
+<h3><a name="TutorialSetup-DownloadEclipse"></a>Download Eclipse </h3>
+
+<p>Download Eclipse <span class="nobr"><a href="http://www.eclipse.org" title="Visit page outside Confluence" rel="nofollow">from here<sup><img class="rendericon" src="../../../../images/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"/></sup></a></span> and unpack it somewhere in the filesystem.</p>
+
+<h3><a name="TutorialSetup-CreateaNewEclipseProject"></a>Create a New Eclipse Project</h3>
+
+<p>Start Eclipse and go to <tt>"File &gt; New &gt; Project"</tt>. Select a "Java Project" for the project type and click "Next":</p>
+
+<p><img src="eclipse-new-project.jpg" align="absmiddle" border="0" /></p>
+
+<p>Enter "cayenne-tutorial" for the project name, select "Create separate source and output folders" radio button and click "Next":</p>
+
+<p><img src="eclipse-project-settings.jpg" align="absmiddle" border="0" /></p>
+
+<p>On the next screen ("Java Settings") go to the "Libraries" tab and click "Add External Jar" button on the right to add two Jar files:</p>
+<ul>
+	<li><tt>derby.jar</tt> located in the "lib" directory of the Derby installation)</li>
+	<li><tt>cayenne.jar</tt> located in the "lib" directory of Cayenne installation.</li>
+</ul>
+
+
+<p><img src="eclipse-java-settings.jpg" align="absmiddle" border="0" /></p>
+
+<p>When done click "Finish" and the new project should appear in Eclipse.</p>
+
+<hr />
+<p><b>Next Step: <a href="../../../../Documentation/Cayenne Guide/Quick Start/Tutorial Starting Mapping Project/index.html" title="Tutorial Starting Mapping Project">Tutorial Starting Mapping 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-2007 Apache Software Foundation
+  </div>
+
+</body>
+</html>

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

Added: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Starting Mapping Project/eclipse-xmlfiles.jpg
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne%20Guide/Quick%20Start/Tutorial%20Starting%20Mapping%20Project/eclipse-xmlfiles.jpg?view=auto&rev=554413
==============================================================================
Binary file - no diff available.

Propchange: cayenne/main/trunk/docs/doc/src/main/resources/doc/Documentation/Cayenne Guide/Quick Start/Tutorial Starting Mapping Project/eclipse-xmlfiles.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message