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 2006/05/10 03:11:01 UTC

svn commit: r405581 [13/14] - in /incubator/cayenne/main/trunk/cayenne/cayenne-other: docs/ docs/images/ wiki-docs/ wiki-docs/Documentation/ wiki-docs/Documentation/Modeler Guide/ wiki-docs/Documentation/Modeler Guide/Cayenne Project Structure/ wiki-do...

Added: incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Queries/Scripting SQLTemplate/index.html
URL: http://svn.apache.org/viewcvs/incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User%20Guide/Queries/Scripting%20SQLTemplate/index.html?rev=405581&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Queries/Scripting SQLTemplate/index.html (added)
+++ incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Queries/Scripting SQLTemplate/index.html Tue May  9 18:10:42 2006
@@ -0,0 +1,234 @@
+<html>
+  <head>
+    <title>Cayenne Documentation - Scripting SQLTemplate</title>
+    <style type="text/css">@import "../../../../style.css";</style>
+  </head>
+<body>
+  <div class="header">
+    <div style="float: left;"><a href="http://objectstyle.org/cayenne/"><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">Scripting SQLTemplate</span>
+  </div>
+<div id="cayenne_toc">
+<ul>
+<li><a href="../../../../Documentation/User Guide/Introduction/index.html">Introduction</a></li>
+<li><a href="../../../../Documentation/User Guide/Installation/index.html">Installation</a></li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/index.html">Quick Start</a></li>
+<li><a href="../../../../Documentation/User Guide/Design/index.html">Design</a></li>
+<li><a href="../../../../Documentation/User Guide/Generating Classes/index.html">Generating Classes</a></li>
+<li><a href="../../../../Documentation/User Guide/DataContext/index.html">DataContext</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/index.html">Queries</a><ul>
+<li><a href="../../../../Documentation/User Guide/Queries/Caching Query Results/index.html">Caching Query Results</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Customizing Queries/index.html">Customizing Queries</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/NamedQuery/index.html">NamedQuery</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/ObjectIdQuery/index.html">ObjectIdQuery</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Parameterized Queries/index.html">Parameterized Queries</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Qualifier Expressions/index.html">Qualifier Expressions</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Queries Stored in DataMap/index.html">Queries Stored in DataMap</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/QueryChain/index.html">QueryChain</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/RelationshipQuery/index.html">RelationshipQuery</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/SQLTemplate Query/index.html">SQLTemplate Query</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Scripting SQLTemplate/index.html">Scripting SQLTemplate</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/User Guide/Queries/SelectQuery/index.html">SelectQuery</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/SelectQuery Customization/index.html">SelectQuery Customization</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Using Orderings/index.html">Using Orderings</a></li>
+</ul>
+</li>
+<li><a href="../../../../Documentation/User Guide/DataObjects/index.html">DataObjects</a></li>
+<li><a href="../../../../Documentation/User Guide/Stored Procedures/index.html">Stored Procedures</a></li>
+<li><a href="../../../../Documentation/User Guide/Expressions/index.html">Expressions</a></li>
+<li><a href="../../../../Documentation/User Guide/Performance Tuning/index.html">Performance Tuning</a></li>
+<li><a href="../../../../Documentation/User Guide/Deployment/index.html">Deployment</a></li>
+<li><a href="../../../../Documentation/User Guide/Ant Tasks/index.html">Ant Tasks</a></li>
+<li><a href="../../../../Documentation/User Guide/Access Stack Internals/index.html">Access Stack Internals</a></li>
+<li><a href="../../../../Documentation/User Guide/DataViews/index.html">DataViews</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent"><p>SQLTemplate's internal SQL string is a dynamic script that is processed at runtime to generate PreparedStatement SQL code. Dynamic nature of SQLTemplate makes possible a few important things - it allows to bind parameters on the fly; it provides a way to pass extra information to Cayenne that is not included in the SQL text; it supports including/excluding chunks of SQL depending on runtime parameters.</p>
+
+<p>Scripting of SQL strings is done using <span class="nobr"><a href="http://jakarta.apache.org/velocity" title="Visit page outside Confluence" rel="nofollow">Jakarta Velocity<sup><img class="rendericon" src="../../../../images/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"/></sup></a></span>. Velocity was chosen primarily for its concise template language (no XML tags within SQL!) that doesn't conflict with the SQL syntax. When creating dynamic SQL template, all standard Velocity directives are available, including <tt>#set</tt>, <tt>#foreach</tt>, <tt>#if</tt>. However due to the nature of the SQL and the need to integrate it with Cayenne runtime, only a few Cayenne custom directives are normally used. These directives (<tt>#bind</tt>..., <tt>#result</tt>, <tt>#chain</tt>, <tt>#chunk</tt>) are described below.</p>
+<table cellpadding='5' width='85%' cellspacing='8px' class='noteMacro' border="0" align='center'><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="strong">Directive Syntax Note</b><br />Velocity directives start with pound sign (#) and have their parameters separated by space, not comma. E.g. <tt>#bind('SOMESTRING' 'VARCHAR')</tt>.</td></tr></table>
+
+<h3><a name="ScriptingSQLTemplate-NamedParameters"></a>Named Parameters</h3>
+<p><tt>SQLTemplate.setParameters(java.util.Map)</tt> allows setting a number of named parameters that are used to build parts of the query. During template processing by Velocity all keys in the parameters map are available as variables. For example if the map contains a key "name", its value can be referenced as "$name" in the template. Value of the parameter will be insterted in the SQL unmodified:</p>
+
+<h5><a name="ScriptingSQLTemplate-NamedParametersExample"></a>Named Parameters Example</h5>
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-comment">// build SQLTemplate
+</span><span class="code-object">String</span> sql = <span class="code-quote">"delete from $tableName"</span>;
+SQLTemplate delete = <span class="code-keyword">new</span> SQLTemplate(Artist.class, sql, <span class="code-keyword">false</span>);
+...
+<span class="code-comment">// <span class="code-keyword">this</span> will create a query <span class="code-quote">"delete from ARTIST"</span>
+</span>update.setParameters(Collections.singletonMap(<span class="code-quote">"tableName"</span>, <span class="code-quote">"ARTIST"</span>));
+...
+<span class="code-comment">// <span class="code-keyword">this</span> will create a query <span class="code-quote">"delete from PAINTING"</span>
+</span>update.setParameters(Collections.singletonMap(<span class="code-quote">"tableName"</span>, <span class="code-quote">"PAINTING"</span>));</pre>
+</div></div>
+
+<h3><a name="ScriptingSQLTemplate-DescribingtheResults%23resultDirective"></a>Describing the Results - #result Directive</h3>
+
+<p><tt>#result</tt> directive is used in selecting SQLTemplates to quickly map an arbitrary ResultSet to a DataObject (or a data row with known keys), and also to control Java types of result values. #result directive has a variable number of arguments:</p>
+
+<ul>
+	<li><tt>#result(columnName)</tt> - e.g. <tt>#result('ARTIST_NAME')</tt></li>
+	<li><tt>#result(columnName javaType)</tt> - e.g. <tt>#result('DATE_OF_BIRTH' 'java.util.Date')</tt></li>
+	<li><tt>#result(columnName javaType columnAlias)</tt> - e.g. <tt>#result('DATE_OF_BIRTH' 'java.util.Date' 'DOB')</tt> - in this case returned data row will use "DOB" instead of "DATE_OF_BIRTH" for the result value.</li>
+</ul>
+
+
+<table cellpadding='5' width='85%' cellspacing='8px' class='noteMacro' border="0" align='center'><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>Generally "javaType" argument is a fully-qualified Java class name for a given result column. However for simplicity most common Java types used in JDBC can be specified without a package. These include all numeric types, primitives, String, SQL dates, BigDecimal and BigInteger. So "#result('A' 'String')", "#result('B' 'java.lang.String')" and "#result('C' 'int')" are all valid.</td></tr></table>
+
+<p>While "select * from" queries may work just fine, in most cases it is a good idea to explicitly describe results.</p>
+
+<h5><a name="ScriptingSQLTemplate-%23resultExamples"></a>#result Examples</h5>
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-comment">// build selecting SQLTemplate
+</span><span class="code-object">String</span> sql = <span class="code-quote">"SELECT"</span>
+   + <span class="code-quote">" #result('ARTIST_ID' '<span class="code-object">int</span>'),"</span>
+   + <span class="code-quote">" #result('ARTIST_NAME' '<span class="code-object">String</span>'),"</span>
+   + <span class="code-quote">" #result('DATE_OF_BIRTH' 'java.util.Date')"</span>
+   + <span class="code-quote">" FROM ARTIST"</span>;
+SQLTemplate select = <span class="code-keyword">new</span> SQLTemplate(Artist.class, sql, <span class="code-keyword">true</span>);
+...
+DataContext context...;
+List artists = context.performQuery(select);</pre>
+</div></div>
+
+<h3><a name="ScriptingSQLTemplate-BindingParameters%23bindDirective"></a>Binding Parameters - #bind Directive</h3>
+<p>SQLTemplate uses <tt>#bind</tt> directive to indicate value binding. It has the same meaning as PreparedStatement question mark ("?"), however it also tells Cayenne about the nature of the bound value, so it should be used for all bindings. <tt>#bind()</tt> directive can have a variable number of arguments. The following are the valid invocation formats:</p>
+
+<ul>
+	<li><tt>#bind(value)</tt> - e.g. <tt>#bind($xyz)</tt> or <tt>#bind('somestring')</tt></li>
+	<li><tt>#bind(value jdbcTypeName)</tt> - e.g. <tt>#bind($xyz 'VARCHAR')</tt>. Second argument is the name of JDBC type for this binding. Valid JDBC types are defined in java.sql.Types class. This form is the the most common and useful. It is generally preferred to the single argument form, as it explicitly tells what type of JDBC value this binding is.</li>
+	<li><tt>#bind(value jdbcTypeName precision)</tt> - e.g. <tt>#bind($xyz 'DECIMAL' 2)</tt></li>
+</ul>
+
+
+<h5><a name="ScriptingSQLTemplate-%23binddirectiveexample"></a>#bind directive example</h5>
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-comment">// build SQLTemplate
+</span><span class="code-object">String</span> sql = <span class="code-quote">"update ARTIST set ARTIST_NAME = #bind($name) where ARTIST_ID = #bind($id)"</span>;
+SQLTemplate update = <span class="code-keyword">new</span> SQLTemplate(Artist.class, sql, <span class="code-keyword">false</span>);
+...
+<span class="code-comment">// set parameters and run it...
+</span>Map parameters = <span class="code-keyword">new</span> HashMap();
+parameters.put(<span class="code-quote">"name"</span>, <span class="code-quote">"Publo Picasso"</span>);
+parameters.put(<span class="code-quote">"id"</span>, <span class="code-keyword">new</span> <span class="code-object">Integer</span>(1001));
+update.setParameters(parameters);
+
+DataContext context...;
+context.performNonSelectingQuery(update);</pre>
+</div></div>
+
+<p>SQLTemplate also supports binding Collections for building <tt>IN ( .. )</tt> queries. In any of the <tt>#bind</tt> invocation formats above, you may specify a Collection of values in place of <tt>value</tt>, and Cayenne will automatically expand it.</p>
+
+<h5><a name="ScriptingSQLTemplate-Collectionexample"></a>Collection example</h5>
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-comment">// build SQLTemplate
+</span><span class="code-object">String</span> sql = "SELECT ARTIST_ID, ARTIST_NAME FROM ARTIST WHERE ARTIST_NAME IN (#bind($names))
+SQLTemplate select = <span class="code-keyword">new</span> SQLTemplate(Artist.class, sql, <span class="code-keyword">false</span>);
+...
+<span class="code-comment">// set parameters and run it...
+</span>Map parameters = <span class="code-keyword">new</span> HashMap();
+parameters.put(<span class="code-quote">"names"</span>, Arrays.asList(<span class="code-keyword">new</span> <span class="code-object">String</span>[] { <span class="code-quote">"Monet"</span>, <span class="code-quote">"Publo Picasso"</span>}));
+select.setParameters(parameters);
+
+DataContext context...;
+List artists = context.performQuery(select);</pre>
+</div></div>
+
+
+<h3><a name="ScriptingSQLTemplate-NullValuesinBindings%23bindEqualand%23bindNotEqualDirectives"></a>Null Values in Bindings - #bindEqual and #bindNotEqual Directives</h3>
+<p>Sometimes when a parameter is NULL, SQL code has to be changed. For example, instead of "WHERE COLUMN = ?", PreparedStatement should be rewritten as "WHERE COLUMN IS NULL", and instead of "WHERE COLUMN &lt;&gt; ?" - as "WHERE COLUMN IS NOT NULL". <tt>#bindEqual</tt> and <tt>#bindNotEqual</tt> directives are used to dynamically generate correct SQL string in this case. Their semantics is the same as #bind directive above, except that they do not require "=", "!=" or "&lt;&gt;" in front of them:</p>
+
+<ul>
+	<li><tt>#bindEqual(value)</tt>, <tt>#bindNotEqual(value)</tt></li>
+	<li><tt>#bindEqual(value jdbcTypeName)</tt>, <tt>#bindNotEqual(value jdbcTypeName)</tt></li>
+	<li><tt>#bindEqual(value jdbcTypeName precision)</tt>, <tt>#bindNotEqual(value jdbcTypeName precision)</tt></li>
+</ul>
+
+
+<h5><a name="ScriptingSQLTemplate-NullValueExamples"></a>Null Value Examples</h5>
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-comment">// build SQLTemplate
+</span><span class="code-comment">// note that <span class="code-quote">"="</span> is ommitted <span class="code-keyword">for</span> the second binding, since it is a part of the directive
+</span><span class="code-object">String</span> sql = "update ARTIST set ARTIST_NAME = #bind($name) where ARTIST_ID #bindEqual($id);
+SQLTemplate update = <span class="code-keyword">new</span> SQLTemplate(Artist.class, sql, <span class="code-keyword">false</span>);
+...
+<span class="code-comment">// set parameters and run it...
+</span>Map parameters = <span class="code-keyword">new</span> HashMap();
+parameters.put(<span class="code-quote">"name"</span>, <span class="code-quote">"Publo Picasso"</span>);
+parameters.put(<span class="code-quote">"id"</span>, <span class="code-keyword">new</span> <span class="code-object">Integer</span>(1001));
+update.setParameters(parameters);
+
+DataContext context...;
+
+<span class="code-comment">// after binding processing PrepapredStatement SQL will look like 
+</span><span class="code-comment">// <span class="code-quote">"update ARTIST set ARTIST_NAME = ? where ARTIST_ID = ?"</span>
+</span>context.performNonSelectingQuery(update);</pre>
+</div></div>
+
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-comment">// build SQLTemplate
+</span><span class="code-comment">// note that <span class="code-quote">"!="</span> is ommitted <span class="code-keyword">for</span> the second binding, since it is a part of the directive
+</span><span class="code-object">String</span> sql = <span class="code-quote">"update ARTIST set ARTIST_NAME = #bind($name) where ARTIST_ID #bindNotEqual($id)"</span>;
+SQLTemplate update = <span class="code-keyword">new</span> SQLTemplate(Artist.class, sql, <span class="code-keyword">false</span>);
+...
+<span class="code-comment">// set parameters and run it...
+</span>Map parameters = <span class="code-keyword">new</span> HashMap();
+parameters.put(<span class="code-quote">"name"</span>, <span class="code-quote">"Publo Picasso"</span>);
+parameters.put(<span class="code-quote">"id"</span>, <span class="code-keyword">null</span>);
+update.setParameters(parameters);
+
+DataContext context...;
+
+<span class="code-comment">// after binding processing PrepapredStatement SQL will look like 
+</span><span class="code-comment">// <span class="code-quote">"update ARTIST set ARTIST_NAME = ? where ARTIST_ID IS NOT NULL"</span>
+</span>context.performNonSelectingQuery(update);</pre>
+</div></div>
+
+<h3><a name="ScriptingSQLTemplate-BuildingDynamicSQL%23chainand%23chunkDirectives"></a>Building Dynamic SQL - #chain and #chunk Directives</h3>
+<p>Often it is desirable to exclude parts of the WHERE clause if some parameters are null or not set. This task is not trivial considering the semantics of a SQL statement. Consider this fairly simple example:</p>
+
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-object">String</span> sql = <span class="code-quote">"SELECT DISTINCT"</span>
+   + <span class="code-quote">" #result('ARTIST_ID' '<span class="code-object">int</span>'),"</span>
+   + <span class="code-quote">" #result('ARTIST_NAME' '<span class="code-object">String</span>'),"</span>
+   + <span class="code-quote">" #result('DATE_OF_BIRTH' 'java.util.Date')"</span>
+   + <span class="code-quote">" FROM ARTIST t0"</span>
+   + <span class="code-quote">" WHERE ARTIST_NAME LIKE #bind($name)"</span>
+   + <span class="code-quote">" OR ARTIST_ID &gt; #bind($id)"</span>;
+SQLTemplate select = <span class="code-keyword">new</span> SQLTemplate(Artist.class, sql, <span class="code-keyword">true</span>);</pre>
+</div></div>
+
+<p>It would be nice to exclude ARTIST_NAME matching if "name" parameter is null, exclude ARTIST_ID matching if "id" is null, and exclude the whole WHERE clause if both are null. <tt>#chain</tt> and <tt>#chunk</tt> directives are used for this purpose. Each logical piece is wrapped in a conditional "chunk", and a number of chunks are grouped in a chain. If chain contains no chunks it doesn't render anything enclosed in it.</p>
+
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-object">String</span> sql = <span class="code-quote">"SELECT DISTINCT"</span>
+   + <span class="code-quote">" #result('ARTIST_ID' '<span class="code-object">int</span>'),"</span>
+   + <span class="code-quote">" #result('ARTIST_NAME' '<span class="code-object">String</span>'),"</span>
+   + <span class="code-quote">" #result('DATE_OF_BIRTH' 'java.util.Date')"</span>
+   + <span class="code-quote">" FROM ARTIST t0"</span>
+   + " #chain('OR' 'WHERE')                              <span class="code-comment">// start chain prefixed by WHERE, 
+</span>                                                         <span class="code-comment">// and joined by OR
+</span>   + <span class="code-quote">" #chunk($name) ARTIST_NAME LIKE #bind($name) #end"</span> <span class="code-comment">// ARTIST_NAME <span class="code-quote">"chunk"</span>
+</span>   + <span class="code-quote">" #chunk($id) ARTIST_ID &gt; #bind($id) #end"</span>          <span class="code-comment">// ARTIST_ID <span class="code-quote">"chunk"</span>
+</span>   + <span class="code-quote">" #end"</span>;                                            <span class="code-comment">// end of chain
+</span>SQLTemplate select = <span class="code-keyword">new</span> SQLTemplate(Artist.class, sql, <span class="code-keyword">true</span>);</pre>
+</div></div>
+
+<h3><a name="ScriptingSQLTemplate-BindingObjectIdValues."></a>Binding ObjectId Values.</h3>
+
+<p>TO BE DONE</p></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-2006 ObjectStyle Group and content authors
+  </div>
+
+</body>
+</html>

Propchange: incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Queries/Scripting SQLTemplate/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Queries/SelectQuery Customization/index.html
URL: http://svn.apache.org/viewcvs/incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User%20Guide/Queries/SelectQuery%20Customization/index.html?rev=405581&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Queries/SelectQuery Customization/index.html (added)
+++ incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Queries/SelectQuery Customization/index.html Tue May  9 18:10:42 2006
@@ -0,0 +1,74 @@
+<html>
+  <head>
+    <title>Cayenne Documentation - SelectQuery Customization</title>
+    <style type="text/css">@import "../../../../style.css";</style>
+  </head>
+<body>
+  <div class="header">
+    <div style="float: left;"><a href="http://objectstyle.org/cayenne/"><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">SelectQuery Customization</span>
+  </div>
+<div id="cayenne_toc">
+<ul>
+<li><a href="../../../../Documentation/User Guide/Introduction/index.html">Introduction</a></li>
+<li><a href="../../../../Documentation/User Guide/Installation/index.html">Installation</a></li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/index.html">Quick Start</a></li>
+<li><a href="../../../../Documentation/User Guide/Design/index.html">Design</a></li>
+<li><a href="../../../../Documentation/User Guide/Generating Classes/index.html">Generating Classes</a></li>
+<li><a href="../../../../Documentation/User Guide/DataContext/index.html">DataContext</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/index.html">Queries</a><ul>
+<li><a href="../../../../Documentation/User Guide/Queries/Caching Query Results/index.html">Caching Query Results</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Customizing Queries/index.html">Customizing Queries</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/NamedQuery/index.html">NamedQuery</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/ObjectIdQuery/index.html">ObjectIdQuery</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Parameterized Queries/index.html">Parameterized Queries</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Qualifier Expressions/index.html">Qualifier Expressions</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Queries Stored in DataMap/index.html">Queries Stored in DataMap</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/QueryChain/index.html">QueryChain</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/RelationshipQuery/index.html">RelationshipQuery</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/SQLTemplate Query/index.html">SQLTemplate Query</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Scripting SQLTemplate/index.html">Scripting SQLTemplate</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/SelectQuery/index.html">SelectQuery</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/SelectQuery Customization/index.html">SelectQuery Customization</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/User Guide/Queries/Using Orderings/index.html">Using Orderings</a></li>
+</ul>
+</li>
+<li><a href="../../../../Documentation/User Guide/DataObjects/index.html">DataObjects</a></li>
+<li><a href="../../../../Documentation/User Guide/Stored Procedures/index.html">Stored Procedures</a></li>
+<li><a href="../../../../Documentation/User Guide/Expressions/index.html">Expressions</a></li>
+<li><a href="../../../../Documentation/User Guide/Performance Tuning/index.html">Performance Tuning</a></li>
+<li><a href="../../../../Documentation/User Guide/Deployment/index.html">Deployment</a></li>
+<li><a href="../../../../Documentation/User Guide/Ant Tasks/index.html">Ant Tasks</a></li>
+<li><a href="../../../../Documentation/User Guide/Access Stack Internals/index.html">Access Stack Internals</a></li>
+<li><a href="../../../../Documentation/User Guide/DataViews/index.html">DataViews</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent"><p><span class="nobr"><a href="http://objectstyle.org/cayenne/api/cayenne/org/objectstyle/cayenne/query/SelectQuery.html" title="Visit page outside Confluence" rel="nofollow">SelectQueries<sup><img class="rendericon" src="../../../../images/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"/></sup></a></span> allow to fine tune the behavior of the fetch using the following API:</p>
+<ul>
+	<li>public void <b>setFetchLimit</b>(int fetchLimit)<br/>
+ If set to a value greater than zero, tells Cayenne that query should never retrieve more than X objects (X == fetchLimit) from the database. If a result set contains more rows, they are simply ignored and never read. This is a "safety" feature that can be used to prevent the application from crashing when an unexpectedly high number of records exists for a given query.</li>
+</ul>
+
+
+<ul>
+	<li>public void <b>setDistinct</b>(boolean distinct)<br/>
+ If set to true (default is false), tells Cayenne that query should fetch distinct rows.</li>
+	<li>public void <b>setFetchingDataRows</b>(boolean flag)<br/>
+ If set to true (default is false), tells Cayenne that instead of creating DataObjects, it should fetch "data rows" - dictionaries containing database values, using table column names for the keys. "Performance Tuning" chapter explains how data rows can improve performance and how and when to use them.</li>
+	<li>public void <b>setPageSize</b>(int pageSize)<br/>
+ If set to a value greater than zero, tells Cayenne that query should do a "lazy" fetch, breaking result into "pages". <a href="../../../../Documentation/User Guide/Performance Tuning/index.html" title="Performance Tuning">Performance Tuning</a> has a detailed discussion of paged queries.</li>
+</ul>
+</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-2006 ObjectStyle Group and content authors
+  </div>
+
+</body>
+</html>

Propchange: incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Queries/SelectQuery Customization/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Queries/SelectQuery/index.html
URL: http://svn.apache.org/viewcvs/incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User%20Guide/Queries/SelectQuery/index.html?rev=405581&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Queries/SelectQuery/index.html (added)
+++ incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Queries/SelectQuery/index.html Tue May  9 18:10:42 2006
@@ -0,0 +1,119 @@
+<html>
+  <head>
+    <title>Cayenne Documentation - SelectQuery</title>
+    <style type="text/css">@import "../../../../style.css";</style>
+  </head>
+<body>
+  <div class="header">
+    <div style="float: left;"><a href="http://objectstyle.org/cayenne/"><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">SelectQuery</span>
+  </div>
+<div id="cayenne_toc">
+<ul>
+<li><a href="../../../../Documentation/User Guide/Introduction/index.html">Introduction</a></li>
+<li><a href="../../../../Documentation/User Guide/Installation/index.html">Installation</a></li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/index.html">Quick Start</a></li>
+<li><a href="../../../../Documentation/User Guide/Design/index.html">Design</a></li>
+<li><a href="../../../../Documentation/User Guide/Generating Classes/index.html">Generating Classes</a></li>
+<li><a href="../../../../Documentation/User Guide/DataContext/index.html">DataContext</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/index.html">Queries</a><ul>
+<li><a href="../../../../Documentation/User Guide/Queries/Caching Query Results/index.html">Caching Query Results</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Customizing Queries/index.html">Customizing Queries</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/NamedQuery/index.html">NamedQuery</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/ObjectIdQuery/index.html">ObjectIdQuery</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Parameterized Queries/index.html">Parameterized Queries</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Qualifier Expressions/index.html">Qualifier Expressions</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Queries Stored in DataMap/index.html">Queries Stored in DataMap</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/QueryChain/index.html">QueryChain</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/RelationshipQuery/index.html">RelationshipQuery</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/SQLTemplate Query/index.html">SQLTemplate Query</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Scripting SQLTemplate/index.html">Scripting SQLTemplate</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/SelectQuery/index.html">SelectQuery</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/User Guide/Queries/SelectQuery Customization/index.html">SelectQuery Customization</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Using Orderings/index.html">Using Orderings</a></li>
+</ul>
+</li>
+<li><a href="../../../../Documentation/User Guide/DataObjects/index.html">DataObjects</a></li>
+<li><a href="../../../../Documentation/User Guide/Stored Procedures/index.html">Stored Procedures</a></li>
+<li><a href="../../../../Documentation/User Guide/Expressions/index.html">Expressions</a></li>
+<li><a href="../../../../Documentation/User Guide/Performance Tuning/index.html">Performance Tuning</a></li>
+<li><a href="../../../../Documentation/User Guide/Deployment/index.html">Deployment</a></li>
+<li><a href="../../../../Documentation/User Guide/Ant Tasks/index.html">Ant Tasks</a></li>
+<li><a href="../../../../Documentation/User Guide/Access Stack Internals/index.html">Access Stack Internals</a></li>
+<li><a href="../../../../Documentation/User Guide/DataViews/index.html">DataViews</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent"><p>The most commonly used query is <span class="nobr"><a href="http://objectstyle.org/cayenne/api/cayenne/org/objectstyle/cayenne/query/SelectQuery.html" title="Visit page outside Confluence" rel="nofollow">SelectQuery<sup><img class="rendericon" src="../../../../images/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"/></sup></a></span>. It is a descriptor that allows DataContext to fetch lists of DataObjects of the right type matching the specified criteria. SelectQuery together with the DataMap provides just enough information to the Cayenne runtime objects to build the right SQL SELECT statement and control various execution parameters.</p>
+
+<h3><a name="SelectQuery-SelectQueryParts"></a>SelectQuery Parts</h3>
+
+<p>A SelectQuery consists of a root object, qualifier expression and orderings list. Here is a logical correspondence of Cayenne SelectQuery parts and SQL constructs:</p>
+<table class='confluenceTable'><tbody>
+<tr>
+<th class='confluenceTh'> Cayenne SelectQuery </th>
+<th class='confluenceTh'> SQL SELECT statement </th>
+<th class='confluenceTh'> Required </th>
+</tr>
+<tr>
+<td class='confluenceTd'> Root </td>
+<td class='confluenceTd'> FROM clause </td>
+<td class='confluenceTd'> yes </td>
+</tr>
+<tr>
+<td class='confluenceTd'> Qualifier Expression </td>
+<td class='confluenceTd'> WHERE clause </td>
+<td class='confluenceTd'> no </td>
+</tr>
+<tr>
+<td class='confluenceTd'> Orderings </td>
+<td class='confluenceTd'> ORDER BY clause </td>
+<td class='confluenceTd'> no </td>
+</tr>
+</tbody></table>
+<p>The only required query part is root. Query root tells Cayenne what kind of objects to fetch. It can be one of the following:</p>
+<ul>
+	<li><em>(most commonly used)</em> Java class for the type of persistent objects in question.</li>
+	<li>ObjEntity that provides the mapping for the class in question.</li>
+	<li>A String that is an ObjEntity name.</li>
+</ul>
+
+
+<p>SelectQuery provides constructors for all three types. For example:</p>
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-keyword">import</span> org.objectstyle.cayenne.query.SelectQuery;
+...
+<span class="code-comment">// <span class="code-keyword">this</span> is a valid Cayenne query that would allow to fetch
+</span><span class="code-comment">// all records from the ARTIST table as Artist objects
+</span>SelectQuery query = <span class="code-keyword">new</span> SelectQuery(Artist.class);</pre>
+</div></div>
+<p>Other components of the SelectQuery are discussed in the following sections.</p>
+
+<h3><a name="SelectQuery-ExecutingSelectQueries"></a>Executing SelectQueries</h3>
+
+<p>As mentioned earlier, queries are executed via <tt>DataContext.performQuery()</tt>. For instance to fetch all Artists existing in the database the following code is used:</p>
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-keyword">import</span> org.objectstyle.cayenne.query.SelectQuery;
+<span class="code-keyword">import</span> org.objectstyle.cayenne.access.DataContext;
+<span class="code-keyword">import</span> java.util.List;
+...
+DataContext ctxt; <span class="code-comment">// assume <span class="code-keyword">this</span> exists
+</span>SelectQuery query = <span class="code-keyword">new</span> SelectQuery(Artist.class);
+
+<span class="code-comment">// The query would fetch *ALL* rows from the ARTIST table
+</span><span class="code-comment">// The list returned contains Artist objects, one object per row
+</span>List artists = ctxt.performQuery(query);</pre>
+</div></div>
+<p>There is a special case when a query is run using <tt>DataContext.performIteratedQuery()</tt>. This is discussed in "Performance Tuning" chapter.</p></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-2006 ObjectStyle Group and content authors
+  </div>
+
+</body>
+</html>

Propchange: incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Queries/SelectQuery/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Queries/Using Orderings/index.html
URL: http://svn.apache.org/viewcvs/incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User%20Guide/Queries/Using%20Orderings/index.html?rev=405581&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Queries/Using Orderings/index.html (added)
+++ incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Queries/Using Orderings/index.html Tue May  9 18:10:42 2006
@@ -0,0 +1,99 @@
+<html>
+  <head>
+    <title>Cayenne Documentation - Using Orderings</title>
+    <style type="text/css">@import "../../../../style.css";</style>
+  </head>
+<body>
+  <div class="header">
+    <div style="float: left;"><a href="http://objectstyle.org/cayenne/"><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">Using Orderings</span>
+  </div>
+<div id="cayenne_toc">
+<ul>
+<li><a href="../../../../Documentation/User Guide/Introduction/index.html">Introduction</a></li>
+<li><a href="../../../../Documentation/User Guide/Installation/index.html">Installation</a></li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/index.html">Quick Start</a></li>
+<li><a href="../../../../Documentation/User Guide/Design/index.html">Design</a></li>
+<li><a href="../../../../Documentation/User Guide/Generating Classes/index.html">Generating Classes</a></li>
+<li><a href="../../../../Documentation/User Guide/DataContext/index.html">DataContext</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/index.html">Queries</a><ul>
+<li><a href="../../../../Documentation/User Guide/Queries/Caching Query Results/index.html">Caching Query Results</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Customizing Queries/index.html">Customizing Queries</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/NamedQuery/index.html">NamedQuery</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/ObjectIdQuery/index.html">ObjectIdQuery</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Parameterized Queries/index.html">Parameterized Queries</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Qualifier Expressions/index.html">Qualifier Expressions</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Queries Stored in DataMap/index.html">Queries Stored in DataMap</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/QueryChain/index.html">QueryChain</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/RelationshipQuery/index.html">RelationshipQuery</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/SQLTemplate Query/index.html">SQLTemplate Query</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Scripting SQLTemplate/index.html">Scripting SQLTemplate</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/SelectQuery/index.html">SelectQuery</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/SelectQuery Customization/index.html">SelectQuery Customization</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/Using Orderings/index.html">Using Orderings</a><ul>
+</ul>
+</li>
+</ul>
+</li>
+<li><a href="../../../../Documentation/User Guide/DataObjects/index.html">DataObjects</a></li>
+<li><a href="../../../../Documentation/User Guide/Stored Procedures/index.html">Stored Procedures</a></li>
+<li><a href="../../../../Documentation/User Guide/Expressions/index.html">Expressions</a></li>
+<li><a href="../../../../Documentation/User Guide/Performance Tuning/index.html">Performance Tuning</a></li>
+<li><a href="../../../../Documentation/User Guide/Deployment/index.html">Deployment</a></li>
+<li><a href="../../../../Documentation/User Guide/Ant Tasks/index.html">Ant Tasks</a></li>
+<li><a href="../../../../Documentation/User Guide/Access Stack Internals/index.html">Access Stack Internals</a></li>
+<li><a href="../../../../Documentation/User Guide/DataViews/index.html">DataViews</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent"><p>To sort SelectQuery results, orderings are used. Orderings use path expressions discussed in the previous section to identify the attributes that must be used in sorting. For example to order results by artist name, the following code can be used:</p>
+
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-keyword">import</span> org.objectstyle.cayenne.query.SelectQuery;
+...
+SelectQuery query = <span class="code-keyword">new</span> SelectQuery(<span class="code-quote">"Artist"</span>);
+
+<span class="code-comment">// add ordering by Artist name:
+</span>query.addOrdering(<span class="code-quote">"artistName"</span>, <span class="code-keyword">true</span>);</pre>
+</div></div>
+
+<p>Orderings also support in-memory sorting of lists of Java Beans (all DataObjects are normally Java Beans, since they has set/get method pairs for all the properties). For instance to sort with a single ordering, the following code might be used:</p>
+
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-keyword">import</span> org.objectstyle.cayenne.query.Ordering;
+...
+<span class="code-comment">// assume <span class="code-keyword">this</span> is a properly initialized list of Artists
+</span>List list = ...; 
+
+<span class="code-comment">// creates asending ordering by Artist name
+</span>Ordering ordering = <span class="code-keyword">new</span> Ordering(<span class="code-quote">"artistName"</span>, <span class="code-keyword">true</span>);
+
+<span class="code-comment">// orders a list
+</span>ordering.orderList(list);</pre>
+</div></div>
+
+<p>If there is a need to sort on more than one object property, multiple Orderings can be passed as a List to a static method <tt>orderList(List, List)</tt>. The cost of adding new Orderings decreases, as the list of objects ends up being sorted by the first Ordering, then, if any two objects are equal for first Ordering, by the second, and so on.</p>
+
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-keyword">import</span> org.objectstyle.cayenne.query.Ordering;
+...
+<span class="code-comment">// assume <span class="code-keyword">this</span> is a properly initialized list of Paintings
+</span>List list = ...; 
+
+List orderings = <span class="code-keyword">new</span> ArrayList();
+orderings.add(<span class="code-keyword">new</span> Ordering(<span class="code-quote">"paintingTitle"</span>, <span class="code-keyword">true</span>));
+orderings.add(<span class="code-keyword">new</span> Ordering(<span class="code-quote">"estimatedPrice"</span>, <span class="code-keyword">false</span>));
+
+<span class="code-comment">// orders a list aplying multiple orderings
+</span>Ordering.orderList(list, orderings);</pre>
+</div></div></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-2006 ObjectStyle Group and content authors
+  </div>
+
+</body>
+</html>

Propchange: incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Queries/Using Orderings/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Queries/index.html
URL: http://svn.apache.org/viewcvs/incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User%20Guide/Queries/index.html?rev=405581&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Queries/index.html (added)
+++ incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Queries/index.html Tue May  9 18:10:42 2006
@@ -0,0 +1,81 @@
+<html>
+  <head>
+    <title>Cayenne Documentation - Queries</title>
+    <style type="text/css">@import "../../../style.css";</style>
+  </head>
+<body>
+  <div class="header">
+    <div style="float: left;"><a href="http://objectstyle.org/cayenne/"><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">Queries</span>
+  </div>
+<div id="cayenne_toc">
+<ul>
+<li><a href="../../../Documentation/User Guide/Introduction/index.html">Introduction</a></li>
+<li><a href="../../../Documentation/User Guide/Installation/index.html">Installation</a></li>
+<li><a href="../../../Documentation/User Guide/Quick Start/index.html">Quick Start</a></li>
+<li><a href="../../../Documentation/User Guide/Design/index.html">Design</a></li>
+<li><a href="../../../Documentation/User Guide/Generating Classes/index.html">Generating Classes</a></li>
+<li><a href="../../../Documentation/User Guide/DataContext/index.html">DataContext</a></li>
+<li><a href="../../../Documentation/User Guide/Queries/index.html">Queries</a><ul>
+<li><a href="../../../Documentation/User Guide/Queries/Caching Query Results/index.html">Caching Query Results</a></li>
+<li><a href="../../../Documentation/User Guide/Queries/Customizing Queries/index.html">Customizing Queries</a></li>
+<li><a href="../../../Documentation/User Guide/Queries/NamedQuery/index.html">NamedQuery</a></li>
+<li><a href="../../../Documentation/User Guide/Queries/ObjectIdQuery/index.html">ObjectIdQuery</a></li>
+<li><a href="../../../Documentation/User Guide/Queries/Parameterized Queries/index.html">Parameterized Queries</a></li>
+<li><a href="../../../Documentation/User Guide/Queries/Qualifier Expressions/index.html">Qualifier Expressions</a></li>
+<li><a href="../../../Documentation/User Guide/Queries/Queries Stored in DataMap/index.html">Queries Stored in DataMap</a></li>
+<li><a href="../../../Documentation/User Guide/Queries/QueryChain/index.html">QueryChain</a></li>
+<li><a href="../../../Documentation/User Guide/Queries/RelationshipQuery/index.html">RelationshipQuery</a></li>
+<li><a href="../../../Documentation/User Guide/Queries/SQLTemplate Query/index.html">SQLTemplate Query</a></li>
+<li><a href="../../../Documentation/User Guide/Queries/Scripting SQLTemplate/index.html">Scripting SQLTemplate</a></li>
+<li><a href="../../../Documentation/User Guide/Queries/SelectQuery/index.html">SelectQuery</a></li>
+<li><a href="../../../Documentation/User Guide/Queries/SelectQuery Customization/index.html">SelectQuery Customization</a></li>
+<li><a href="../../../Documentation/User Guide/Queries/Using Orderings/index.html">Using Orderings</a></li>
+</ul>
+</li>
+<li><a href="../../../Documentation/User Guide/DataObjects/index.html">DataObjects</a></li>
+<li><a href="../../../Documentation/User Guide/Stored Procedures/index.html">Stored Procedures</a></li>
+<li><a href="../../../Documentation/User Guide/Expressions/index.html">Expressions</a></li>
+<li><a href="../../../Documentation/User Guide/Performance Tuning/index.html">Performance Tuning</a></li>
+<li><a href="../../../Documentation/User Guide/Deployment/index.html">Deployment</a></li>
+<li><a href="../../../Documentation/User Guide/Ant Tasks/index.html">Ant Tasks</a></li>
+<li><a href="../../../Documentation/User Guide/Access Stack Internals/index.html">Access Stack Internals</a></li>
+<li><a href="../../../Documentation/User Guide/DataViews/index.html">DataViews</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent"><p>Queries are Cayenne abstraction for communicating with an external data storage. Queries are Java objects that are generally independent from the SQL dialect used by the target database. Cayenne includes a number of standard queries in the <span class="nobr"><a href="http://objectstyle.org/cayenne/api/cayenne/org/objectstyle/cayenne/query/package-summary.html" title="Visit page outside Confluence" rel="nofollow">org.objectstyle.cayenne.query<sup><img class="rendericon" src="../../../images/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"/></sup></a></span> package. Many of them are only used internally. Here we describe the queries that can be useful in the application.</p>
+
+<h3><a name="Queries-GeneralPurposeQueries"></a>General Purpose Queries</h3>
+
+<ul>
+	<li><a href="../../../Documentation/User Guide/Queries/SelectQuery/index.html" title="SelectQuery">SelectQuery</a> is an "object query" based on some Java class. All its parameters are specified in terms of the properties of this Java class. It is completely portable and SQL-free. SelectQuery is the most commonly used out of the three queries discussed here, as it stays as close to the object model as possible. For most tasks it should be considered the first choice. Other types of queries should be used only if SelectQuery can't address a particular application need.</li>
+	<li><a href="../../../Documentation/User Guide/Queries/SQLTemplate Query/index.html" title="SQLTemplate Query">SQLTemplate Query</a> is a scriptable raw SQL query, that can be both selecting and non-selecting. Main use of SQLTemplate is to create complex SQL queries with structure that has no direct correspondence with the object model. SQLTemplate allows customizing SQL dialect code for more than one target database, encapsulating this fact from the callers. Just like other types of queries, SQLTemplates can be mapped in CayenneModeler, so the code can stay free from SQL building.</li>
+	<li><a href="../../../Documentation/User Guide/Stored Procedures/index.html" title="Stored Procedures">ProcedureQuery</a> is intended to invoke mapped stored procedures. It can be selecting or non-selecting, or even contain multiple result sets and update counts, depending on what the target procedure does.</li>
+</ul>
+
+
+<h3><a name="Queries-OtherHelpfulQueries"></a>Other Helpful Queries</h3>
+
+<ul>
+	<li><a href="../../../Documentation/User Guide/Queries/QueryChain/index.html" title="QueryChain">QueryChain</a> is a Query that is itself a collection of other queries. Its intention is to execute multiple queries in a single batch.</li>
+	<li><a href="../../../Documentation/User Guide/Queries/ObjectIdQuery/index.html" title="ObjectIdQuery">ObjectIdQuery</a> is a query that selects objects matching an ObjectId.</li>
+	<li><a href="../../../Documentation/User Guide/Queries/RelationshipQuery/index.html" title="RelationshipQuery">RelationshipQuery</a> is a query that fetches object(s) related to a single given object via a mapped ObjRelationship.</li>
+	<li><a href="../../../Documentation/User Guide/Queries/NamedQuery/index.html" title="NamedQuery">NamedQuery</a> is a query that is a reference to another query stored in the DataMap.</li>
+</ul>
+
+
+
+<h3><a name="Queries-CustomQueries"></a>Custom Queries</h3>
+
+<p>To extend standard Query functionality, users can create <a href="../../../Documentation/User Guide/Queries/Customizing Queries/index.html" title="Customizing Queries">Custom Queries</a> that implement <tt>org.objectstyle.cayenne.query.Query</tt> interface.</p></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-2006 ObjectStyle Group and content authors
+  </div>
+
+</body>
+</html>

Propchange: incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Queries/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Quick Start/Cayenne Application/index.html
URL: http://svn.apache.org/viewcvs/incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User%20Guide/Quick%20Start/Cayenne%20Application/index.html?rev=405581&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Quick Start/Cayenne Application/index.html (added)
+++ incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Quick Start/Cayenne Application/index.html Tue May  9 18:10:42 2006
@@ -0,0 +1,65 @@
+<html>
+  <head>
+    <title>Cayenne Documentation - Cayenne Application</title>
+    <style type="text/css">@import "../../../../style.css";</style>
+  </head>
+<body>
+  <div class="header">
+    <div style="float: left;"><a href="http://objectstyle.org/cayenne/"><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">Cayenne Application</span>
+  </div>
+<div id="cayenne_toc">
+<ul>
+<li><a href="../../../../Documentation/User Guide/Introduction/index.html">Introduction</a></li>
+<li><a href="../../../../Documentation/User Guide/Installation/index.html">Installation</a></li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/index.html">Quick Start</a><ul>
+<li><a href="../../../../Documentation/User Guide/Quick Start/Cayenne Application/index.html">Cayenne Application</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/Command-Line Tutorial/index.html">Command-Line Tutorial</a></li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/Common Setup Steps/index.html">Common Setup Steps</a></li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/JSP-Struts Tutorial/index.html">JSP-Struts Tutorial</a></li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/Tapestry/index.html">Tapestry</a></li>
+</ul>
+</li>
+<li><a href="../../../../Documentation/User Guide/Design/index.html">Design</a></li>
+<li><a href="../../../../Documentation/User Guide/Generating Classes/index.html">Generating Classes</a></li>
+<li><a href="../../../../Documentation/User Guide/DataContext/index.html">DataContext</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/index.html">Queries</a></li>
+<li><a href="../../../../Documentation/User Guide/DataObjects/index.html">DataObjects</a></li>
+<li><a href="../../../../Documentation/User Guide/Stored Procedures/index.html">Stored Procedures</a></li>
+<li><a href="../../../../Documentation/User Guide/Expressions/index.html">Expressions</a></li>
+<li><a href="../../../../Documentation/User Guide/Performance Tuning/index.html">Performance Tuning</a></li>
+<li><a href="../../../../Documentation/User Guide/Deployment/index.html">Deployment</a></li>
+<li><a href="../../../../Documentation/User Guide/Ant Tasks/index.html">Ant Tasks</a></li>
+<li><a href="../../../../Documentation/User Guide/Access Stack Internals/index.html">Access Stack Internals</a></li>
+<li><a href="../../../../Documentation/User Guide/DataViews/index.html">DataViews</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent"><p>This is an approximate simplified algorithm for creating a Cayenne-enabled application. This should give you some understanding of what is going on in the following chapters. You can skip this page for now and proceed to the tutorials.</p>
+
+<h3><a name="CayenneApplication-CreateCayenneProject"></a>Create Cayenne Project</h3>
+<p>Cayenne project is a set of XML mapping and deployment files used by a Cayenne Java application. Projects are normally created and edited in CayenneModeler GUI tool. All the needed mapping information is either obtained by reverse-engineering an existing database (as shown later in this chapter), or by creating individual mapping components in the Modeler.</p>
+
+<h3><a name="CayenneApplication-GenerateJavaClasses"></a>Generate Java Classes</h3>
+<p>Persistent Java classes (aka DataObjects) are generated and synchronized with the mapping using the Modeler (or alternatively with a "cgen" Ant task).</p>
+
+<h3><a name="CayenneApplication-%28optional%29GenerateDBSchema"></a>(optional) Generate DB Schema</h3>
+<p>If a project wasn't reverse-engineered from an existing database, but rather created manually in the Modeler, a matching database schema can be generated from the Modeler.</p>
+
+<h3><a name="CayenneApplication-WritetheActualApplication"></a>Write the Actual Application</h3>
+<p>Write a Java application taking advantage of Cayenne functionality. Hint: <a href="../../../../Documentation/User Guide/DataContext/index.html" title="DataContext">DataContext</a> is normally a starting point providing an application with access to Cayenne.</p>
+
+<h3><a name="CayenneApplication-ConfigureDeploymentSettings"></a>Configure Deployment Settings</h3>
+<p>Depending on how you plan to deploy your application you may configure Cayenne in a few ways. Possible deployment scenarious include standalone application, web application, EJB application. Standalone applications usually do not require any special configuration. Web applications usually need an entry in a web.xml file. </p></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-2006 ObjectStyle Group and content authors
+  </div>
+
+</body>
+</html>

Propchange: incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Quick Start/Cayenne Application/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Quick Start/Command-Line Tutorial/index.html
URL: http://svn.apache.org/viewcvs/incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User%20Guide/Quick%20Start/Command-Line%20Tutorial/index.html?rev=405581&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Quick Start/Command-Line Tutorial/index.html (added)
+++ incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Quick Start/Command-Line Tutorial/index.html Tue May  9 18:10:42 2006
@@ -0,0 +1,151 @@
+<html>
+  <head>
+    <title>Cayenne Documentation - Command-Line Tutorial</title>
+    <style type="text/css">@import "../../../../style.css";</style>
+  </head>
+<body>
+  <div class="header">
+    <div style="float: left;"><a href="http://objectstyle.org/cayenne/"><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">Command-Line Tutorial</span>
+  </div>
+<div id="cayenne_toc">
+<ul>
+<li><a href="../../../../Documentation/User Guide/Introduction/index.html">Introduction</a></li>
+<li><a href="../../../../Documentation/User Guide/Installation/index.html">Installation</a></li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/index.html">Quick Start</a><ul>
+<li><a href="../../../../Documentation/User Guide/Quick Start/Cayenne Application/index.html">Cayenne Application</a></li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/Command-Line Tutorial/index.html">Command-Line Tutorial</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/Common Setup Steps/index.html">Common Setup Steps</a></li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/JSP-Struts Tutorial/index.html">JSP-Struts Tutorial</a></li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/Tapestry/index.html">Tapestry</a></li>
+</ul>
+</li>
+<li><a href="../../../../Documentation/User Guide/Design/index.html">Design</a></li>
+<li><a href="../../../../Documentation/User Guide/Generating Classes/index.html">Generating Classes</a></li>
+<li><a href="../../../../Documentation/User Guide/DataContext/index.html">DataContext</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/index.html">Queries</a></li>
+<li><a href="../../../../Documentation/User Guide/DataObjects/index.html">DataObjects</a></li>
+<li><a href="../../../../Documentation/User Guide/Stored Procedures/index.html">Stored Procedures</a></li>
+<li><a href="../../../../Documentation/User Guide/Expressions/index.html">Expressions</a></li>
+<li><a href="../../../../Documentation/User Guide/Performance Tuning/index.html">Performance Tuning</a></li>
+<li><a href="../../../../Documentation/User Guide/Deployment/index.html">Deployment</a></li>
+<li><a href="../../../../Documentation/User Guide/Ant Tasks/index.html">Ant Tasks</a></li>
+<li><a href="../../../../Documentation/User Guide/Access Stack Internals/index.html">Access Stack Internals</a></li>
+<li><a href="../../../../Documentation/User Guide/DataViews/index.html">DataViews</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent"><p>This is a simple command-line Cayenne application tutorial. Full tutorial source code is included in Cayenne distribution in "src/tutorials" folder.</p>
+
+<h3><a name="Command-LineTutorial-PreparetheEnvironment"></a>Prepare the Environment</h3>
+
+<p>Make sure you successfully finished <a href="../../../../Documentation/User Guide/Quick Start/Common Setup Steps/index.html" title="Common Setup Steps">common setup steps</a>.</p>
+
+<p>Create a new folder named cayenne-cmd-app anywhere in the filesystem. This directory is referred to as "project directory" further in this chapter. Note that when you are finished going through all the steps below, project directory will become similar to this tutorial source folder distributed with Cayenne.</p>
+
+<h3><a name="Command-LineTutorial-PrepareTutorialDatabase"></a>Prepare Tutorial Database<a name="Command-LineTutorial-PrepareTutorialDatabase"></a></h3>
+
+<p>Run tutorialdb.sql script located in the project directory to create test tables. This script is tested on MySQL, but it should be easy to port to any other RDBMS.</p>
+
+<h3><a name="Command-LineTutorial-SetupDataNode"></a>Setup DataNode<a name="Command-LineTutorial-SetupDataNode"></a></h3>
+
+<p>The following configuration files make up a Cayenne project for this tutorial:</p>
+
+<ul>
+	<li>cayenne.xml</li>
+	<li>datamap.map.xml</li>
+	<li>driverinfo.driver.xml</li>
+</ul>
+
+
+<p>In this step we will change the default information stored in these files to point to your own database. Open cayenne.xml in CayenneModeler and perform the following operations.</p>
+
+<ul>
+	<li>On the left-hand side object tree click on an icon with title "datanode", a DataNode editor panel will open on the right.</li>
+	<li>If the database you are planning to use is NOT MySQL, select an appropriate adapter from the "DB Adapter" dropdown list on the right.</li>
+	<li>From the "Local DataSource" dropdown list select one of the local DataSources configured previously per "Common Setup Steps" instructions. After this is done, click "Sync with Local" button in the bottom right corner.</li>
+	<li>Save the project by clicking "Save" button or selecting File -&gt; Save from the menu.</li>
+</ul>
+
+
+
+<h3><a name="Command-LineTutorial-SetupAutomaticPrimaryKeyGeneration"></a>Setup Automatic Primary Key Generation<a name="Command-LineTutorial-SetupAutomaticPrimaryKeyGeneration"></a></h3>
+
+<p>This step is needed to allow Cayenne to generate primary keys automatically for the newly inserted objects. With project still open in the Modeler, select an icon titled "datamap" on the left, and go to Tools &gt; Generate Database Schema, then follow the steps outlined in the modeler guide to setup the database for <a href="../../../../Documentation/Modeler Guide/Common Modeling Tasks/Generate Primary Key Support/index.html" title="Generate Primary Key Support">primary key generation support</a>.</p>
+
+<h3><a name="Command-LineTutorial-GenerateJavaCodeforDataObjects"></a>Generate Java Code for DataObjects<a name="Command-LineTutorial-GenerateJavaCodeforDataObjects"></a></h3>
+
+<p>In this step we will generate persistent Java classes from the existing mapping information. Create "java" subdirectory in the project directory. It will contain generated classes. In CayenneModeler with "datamap" still selected, go to "Tools &gt; Generate Classes", select the newly created directory as an "Output Directory", and click "Generate" button.</p>
+
+<p>After class generation is done, the following files should appear in the java/test and java/auto subdirectories of the project directory:</p>
+
+<ul>
+	<li>_Artist.java</li>
+	<li>Artist.java</li>
+	<li>_Painting.java</li>
+	<li>Painting.java</li>
+	<li>_Gallery.java</li>
+	<li>Gallery.java</li>
+</ul>
+
+
+
+<h3><a name="Command-LineTutorial-ApplicationCode"></a>Application Code</h3>
+
+<p>A simple application that uses Cayenne is located in Main.java. Copy the source file to the java/test project subdirectory.</p>
+
+<h3><a name="Command-LineTutorial-CompileandRuntheApplication"></a>Compile and Run the Application</h3>
+
+<p>Compile the source code (assume that JAVA_HOME variable points to the JSDK 1.4 installation). On Windows:</p>
+
+<div class="preformatted"><div class="preformattedContent">
+<pre>projectdir&gt; set CLASSPATH=%CLASSPATH%;%CAYENNE_HOME%\lib\cayenne.jar
+projectdir&gt; %JAVA_HOME%\bin\javac java\test\*.java 
+</pre>
+</div></div>
+<p>On UNIX:</p>
+<div class="preformatted"><div class="preformattedContent">
+<pre>projectdir# export CLASSPATH=$CLASSPATH:$CAYENNE_HOME/lib/cayenne.jar
+projectdir# $JAVA_HOME/bin/javac java/test/*.java 
+</pre>
+</div></div>
+<p>Main tutorial class is "test.Main". It takes a single parameter - a search word to look up a gallery by name. It will try to find a matching gallery, then create a new artist (Salvador Dali) with a single painting and add this painting to the found gallery. To run the tutorial do something like this (example given for Windows):</p>
+<div class="preformatted"><div class="preformattedContent">
+<pre>projectdir&gt; set CLASSPATH=%CLASSPATH%;java
+projectdir&gt; %JAVA_HOME%\bin\java test.Main metro 
+</pre>
+</div></div>
+<p>If there is a gallery matching search criteria (in our case "Metropolitan Museum of Art" would match the word "metro"), the following output will be printed:</p>
+<div class="preformatted"><div class="preformattedContent">
+<pre>WARN  QueryLogger: --- will run 1 query.
+WARN  QueryLogger: SELECT t0.GALLERY_NAME, t0.GALLERY_ID 
+FROM GALLERY t0 WHERE UPPER(t0.GALLERY_NAME) LIKE UPPER(?) 
+[params: '%metro%'] - prepared in 20 ms.
+WARN  QueryLogger: === returned 1 row. - took 0 ms.
+</pre>
+</div></div>
+<p>Found gallery 'The Metropolitan Museum of Art'.</p>
+<div class="preformatted"><div class="preformattedContent">
+<pre>WARN  QueryLogger: --- will run 2 queries.
+WARN  QueryLogger: INSERT INTO ARTIST (ARTIST_ID, DATE_OF_BIRTH, ARTIST_NAME) 
+VALUES (?, ?, ?) [params: 320, NULL, 'Salvador Dali']
+WARN  QueryLogger: === updated 1 row.
+WARN  QueryLogger: INSERT INTO PAINTING (PAINTING_ID, ARTIST_ID, 
+ESTIMATED_PRICE, PAINTING_TITLE) VALUES (?, ?, ?, ?) 
+[params: 320, 320, NULL, 'Sleep']
+WARN  QueryLogger: === updated 1 row.
+WARN  QueryLogger: +++ transaction committed. 
+</pre>
+</div></div></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-2006 ObjectStyle Group and content authors
+  </div>
+
+</body>
+</html>

Propchange: incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Quick Start/Command-Line Tutorial/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Quick Start/Common Setup Steps/index.html
URL: http://svn.apache.org/viewcvs/incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User%20Guide/Quick%20Start/Common%20Setup%20Steps/index.html?rev=405581&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Quick Start/Common Setup Steps/index.html (added)
+++ incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Quick Start/Common Setup Steps/index.html Tue May  9 18:10:42 2006
@@ -0,0 +1,71 @@
+<html>
+  <head>
+    <title>Cayenne Documentation - Common Setup Steps</title>
+    <style type="text/css">@import "../../../../style.css";</style>
+  </head>
+<body>
+  <div class="header">
+    <div style="float: left;"><a href="http://objectstyle.org/cayenne/"><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">Common Setup Steps</span>
+  </div>
+<div id="cayenne_toc">
+<ul>
+<li><a href="../../../../Documentation/User Guide/Introduction/index.html">Introduction</a></li>
+<li><a href="../../../../Documentation/User Guide/Installation/index.html">Installation</a></li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/index.html">Quick Start</a><ul>
+<li><a href="../../../../Documentation/User Guide/Quick Start/Cayenne Application/index.html">Cayenne Application</a></li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/Command-Line Tutorial/index.html">Command-Line Tutorial</a></li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/Common Setup Steps/index.html">Common Setup Steps</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/JSP-Struts Tutorial/index.html">JSP-Struts Tutorial</a></li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/Tapestry/index.html">Tapestry</a></li>
+</ul>
+</li>
+<li><a href="../../../../Documentation/User Guide/Design/index.html">Design</a></li>
+<li><a href="../../../../Documentation/User Guide/Generating Classes/index.html">Generating Classes</a></li>
+<li><a href="../../../../Documentation/User Guide/DataContext/index.html">DataContext</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/index.html">Queries</a></li>
+<li><a href="../../../../Documentation/User Guide/DataObjects/index.html">DataObjects</a></li>
+<li><a href="../../../../Documentation/User Guide/Stored Procedures/index.html">Stored Procedures</a></li>
+<li><a href="../../../../Documentation/User Guide/Expressions/index.html">Expressions</a></li>
+<li><a href="../../../../Documentation/User Guide/Performance Tuning/index.html">Performance Tuning</a></li>
+<li><a href="../../../../Documentation/User Guide/Deployment/index.html">Deployment</a></li>
+<li><a href="../../../../Documentation/User Guide/Ant Tasks/index.html">Ant Tasks</a></li>
+<li><a href="../../../../Documentation/User Guide/Access Stack Internals/index.html">Access Stack Internals</a></li>
+<li><a href="../../../../Documentation/User Guide/DataViews/index.html">DataViews</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent"><p>These setup steps are the same for all tutorials in this chapter:</p>
+
+<ol>
+	<li>Install Cayenne:<br/>
+Check <a href="../../../../Documentation/User Guide/Installation/index.html" title="Installation">Installation</a> and <span class="error">&#91;Unpacking&#93;</span> instructions. In particular, JDK 1.4 or newer must be installed.</li>
+	<li>Get access to a Relational Database:<br/>
+For instance this can be a shared database running somewhere on the server in your organization. If you don't have access to such database (or don't have permissions to create and drop tables in it), it will probably be simpler if you install a local database on the development machine. All the tutorial SQL scripts were written for MySQL, so installing MySQL should be the simplest option.</li>
+	<li>Install JDBC Driver:<br/>
+Install JDBC driver for the database used in step (2). Put the driver jars somewhere in the filesystem. You don't have to add them to CLASSPATH for the CayenneModeler to run, however you may need to do that to run your application.</li>
+	<li>Start CayenneModeler GUI Application, Configure Driver Settings:<br/>
+Follow <a href="../../../../Documentation/Modeler Guide/Introduction to CayenneModeler/Running CayenneModeler/index.html" title="Running CayenneModeler">these</a> instructions to start the Modeler.</li>
+	<li>Configure Driver Settings:<br/>
+In the Modeler go to "Tools &gt; Preferences &gt; ClassPath" and create an entry or entries for the JDBC driver JAR files installed in the step (3). Once these preferences are saved, they will be used by the Modeler, even after it is restarted.</li>
+	<li>Configure Preferred DataSources:<br/>
+Go to "Tools &gt; Preferences &gt; Local DataSources" and configure one or more named DataSources for any databases you might need to access now and in the future. A documentation for this operation can be found <a href="../../../../Documentation/Modeler Guide/Preferences Panel/Local DataSources/index.html" title="Local DataSources">here</a>. This step is optional, however performing it now will speed up any database work that you will do when working on tutorials and with your own application.
+<table cellpadding='5' width='85%' cellspacing='8px' class='infoMacro' border="0" align='center'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="../../../../images/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>Source code for the tutorials discussed in this chapter is bundled with Cayenne distribution. More advanced Cayenne examples are available as a separate download from the download page.</td></tr></table></li>
+</ol>
+
+
+<p>Database schema used in all tutorials in this chapter is shown below:</p>
+
+<p><img src="quickstart-schema.jpg" align="absmiddle" border="0" /></p></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-2006 ObjectStyle Group and content authors
+  </div>
+
+</body>
+</html>

Propchange: incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Quick Start/Common Setup Steps/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Quick Start/Common Setup Steps/quickstart-schema.jpg
URL: http://svn.apache.org/viewcvs/incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User%20Guide/Quick%20Start/Common%20Setup%20Steps/quickstart-schema.jpg?rev=405581&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Quick Start/Common Setup Steps/quickstart-schema.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Quick Start/JSP-Struts Tutorial/index.html
URL: http://svn.apache.org/viewcvs/incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User%20Guide/Quick%20Start/JSP-Struts%20Tutorial/index.html?rev=405581&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Quick Start/JSP-Struts Tutorial/index.html (added)
+++ incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Quick Start/JSP-Struts Tutorial/index.html Tue May  9 18:10:42 2006
@@ -0,0 +1,107 @@
+<html>
+  <head>
+    <title>Cayenne Documentation - JSP-Struts Tutorial</title>
+    <style type="text/css">@import "../../../../style.css";</style>
+  </head>
+<body>
+  <div class="header">
+    <div style="float: left;"><a href="http://objectstyle.org/cayenne/"><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">JSP-Struts Tutorial</span>
+  </div>
+<div id="cayenne_toc">
+<ul>
+<li><a href="../../../../Documentation/User Guide/Introduction/index.html">Introduction</a></li>
+<li><a href="../../../../Documentation/User Guide/Installation/index.html">Installation</a></li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/index.html">Quick Start</a><ul>
+<li><a href="../../../../Documentation/User Guide/Quick Start/Cayenne Application/index.html">Cayenne Application</a></li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/Command-Line Tutorial/index.html">Command-Line Tutorial</a></li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/Common Setup Steps/index.html">Common Setup Steps</a></li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/JSP-Struts Tutorial/index.html">JSP-Struts Tutorial</a><ul>
+</ul>
+</li>
+<li><a href="../../../../Documentation/User Guide/Quick Start/Tapestry/index.html">Tapestry</a></li>
+</ul>
+</li>
+<li><a href="../../../../Documentation/User Guide/Design/index.html">Design</a></li>
+<li><a href="../../../../Documentation/User Guide/Generating Classes/index.html">Generating Classes</a></li>
+<li><a href="../../../../Documentation/User Guide/DataContext/index.html">DataContext</a></li>
+<li><a href="../../../../Documentation/User Guide/Queries/index.html">Queries</a></li>
+<li><a href="../../../../Documentation/User Guide/DataObjects/index.html">DataObjects</a></li>
+<li><a href="../../../../Documentation/User Guide/Stored Procedures/index.html">Stored Procedures</a></li>
+<li><a href="../../../../Documentation/User Guide/Expressions/index.html">Expressions</a></li>
+<li><a href="../../../../Documentation/User Guide/Performance Tuning/index.html">Performance Tuning</a></li>
+<li><a href="../../../../Documentation/User Guide/Deployment/index.html">Deployment</a></li>
+<li><a href="../../../../Documentation/User Guide/Ant Tasks/index.html">Ant Tasks</a></li>
+<li><a href="../../../../Documentation/User Guide/Access Stack Internals/index.html">Access Stack Internals</a></li>
+<li><a href="../../../../Documentation/User Guide/DataViews/index.html">DataViews</a></li>
+</ul>
+</div>
+<div id="ConfluenceContent"><p>This is a simple Cayenne web application tutorial. Full tutorial source code is included in Cayenne distribution in "src/tutorials" folder.</p>
+
+<h3><a name="JSP-StrutsTutorial-PreparetheEnvironment"></a>Prepare the Environment</h3>
+
+<p>Make sure you successfully finished <a href="../../../../Documentation/User Guide/Quick Start/Common Setup Steps/index.html" title="Common Setup Steps">common setup steps</a>.</p>
+
+<p>Install a web container. This tutorial was tested with <span class="nobr"><a href="http://jakarta.apache.org/tomcat/index.html" title="Visit page outside Confluence" rel="nofollow">Tomcat<sup><img class="rendericon" src="../../../../images/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"/></sup></a></span>. It should work with any other container that is compliant with Servlet 2.3 specification. All references to Tomcat below should apply in some form to other web containers as well.</p>
+
+<p>Use tutorial source directory distributed with Cayenne at $CAYENNE_HOME/src/tutorials/cayenne-web-app as a project directory.</p>
+
+<p>Copy cayenne.jar to the WEB-INF/lib subdirectory of the tutorial project directory.</p>
+
+<p>Copy JDBC driver jar file to WEB-INF/lib subdirectory of the tutorial project.</p>
+
+<p>Install Struts (Tutorial was testsed with Struts 1.1, other versions of Struts may require a different setup):</p>
+
+<ul>
+	<li>Download Struts from <span class="nobr"><a href="http://jakarta.apache.org/struts/index.html" title="Visit page outside Confluence" rel="nofollow">Jakarta Struts site<sup><img class="rendericon" src="../../../../images/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"/></sup></a></span>, unpack it to any convenient directory.</li>
+	<li>Copy all JAR files distributed with Struts (located in lib subdirectory) to WEB-INF/lib subdirectory of the tutorial project.</li>
+	<li>Copy all the *.tld files and validator-rules.xml from Struts lib subdirectory to WEB-INF subdirectory of the tutorial project.</li>
+</ul>
+
+
+
+
+<h3><a name="JSP-StrutsTutorial-PrepareTutorialDatabase"></a>Prepare Tutorial Database</h3>
+<p>See <a href="http://www.objectstyle.org/confluence/confluence/display/CAYDOC/Command-Line+Tutorial#Command-LineTutorial-PrepareTutorialDatabase" title="Prepare Tutorial Database on Command-Line Tutorial">Command&#45;Line Tutorial#Prepare Tutorial Database</a>. </p>
+<h3><a name="JSP-StrutsTutorial-SetupDataNode"></a>Setup DataNode</h3>
+
+<p>See <a href="http://www.objectstyle.org/confluence/confluence/display/CAYDOC/Command-Line+Tutorial#Command-LineTutorial-SetupDataNode" title="Setup DataNode on Command-Line Tutorial">Command&#45;Line Tutorial#Setup DataNode</a>.</p>
+
+<h3><a name="JSP-StrutsTutorial-SetupAutomaticPrimaryKeyGeneration"></a>Setup Automatic Primary Key Generation</h3>
+
+<p>See <a href="http://www.objectstyle.org/confluence/confluence/display/CAYDOC/Command-Line+Tutorial#Command-LineTutorial-SetupAutomaticPrimaryKeyGeneration" title="Setup Automatic Primary Key Generation on Command-Line Tutorial">Command&#45;Line Tutorial#Setup Automatic Primary Key Generation</a>.</p>
+
+<h3><a name="JSP-StrutsTutorial-GenerateJavaCodeforDataObjects"></a>Generate Java Code for DataObjects</h3>
+
+<p>See <a href="http://www.objectstyle.org/confluence/confluence/display/CAYDOC/Command-Line+Tutorial#Command-LineTutorial-GenerateJavaCodeforDataObjects" title="Generate Java Code for Data Objects on Command-Line Tutorial">Command&#45;Line Tutorial#Generate Java Code for Data Objects</a>.</p>
+
+<h3><a name="JSP-StrutsTutorial-CompileandDeploytheApplication"></a>Compile and Deploy the Application</h3>
+
+<p>Compile the source code like you would normally compile a webapplication. The example is given for javac from the command line (assuming that JAVA_HOME variable points to the JDK 1.3 or 1.4 installation). Substitute [servlet.jar] with the path to the actiual JAR file, for instance tomcat/common/lib/servlet.jar On Windows:</p>
+
+<div class="preformatted"><div class="preformattedContent">
+<pre>cayenne-web-app&gt; cd WEB-INF\classes
+classes&gt; set CLASSPATH=%CLASSPATH%;[servlet.jar] 
+classes&gt; set CLASSPATH=%CLASSPATH%;..\lib\struts.jar;..\lib\cayenne.jar
+classes&gt; %JAVA_HOME%\bin\javac webtest\*.java formbean\*.java action\*.java
+</pre>
+</div></div>
+<p>On UNIX:</p>
+<div class="preformatted"><div class="preformattedContent">
+<pre>cayenne-web-app# cd WEB-INF/classes
+classes# export CLASSPATH=$CLASSPATH:[servlet.jar]:../lib/struts.jar:../lib/cayenne.jar
+classes# $JAVA_HOME/bin/javac webtest/*.java formbean/*.java action/*.java
+</pre>
+</div></div>
+<p>To deploy, simply copy cayenne-web-app directory to Tomcat webapps directory and restart the Tomcat. URL of the new applications is <span class="nobr"><a href="http://localhost:8080/cayenne-web-app/" title="Visit page outside Confluence" rel="nofollow">http://localhost:8080/cayenne-web-app/<sup><img class="rendericon" src="../../../../images/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"/></sup></a></span> (on containers other then Tomcat, this will be different). </p></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-2006 ObjectStyle Group and content authors
+  </div>
+
+</body>
+</html>

Propchange: incubator/cayenne/main/trunk/cayenne/cayenne-other/wiki-docs/Documentation/User Guide/Quick Start/JSP-Struts Tutorial/index.html
------------------------------------------------------------------------------
    svn:eol-style = native