You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by bu...@apache.org on 2012/11/07 12:39:03 UTC
svn commit: r837544 [1/2] - in /websites/staging/cayenne/trunk/content: ./
v31/ v31/tutorial/ v31/tutorial/css/ v31/tutorial/images/ v31/tutorial/index/
Author: buildbot
Date: Wed Nov 7 11:39:02 2012
New Revision: 837544
Log:
Staging update by buildbot for cayenne
Added:
websites/staging/cayenne/trunk/content/v31/
websites/staging/cayenne/trunk/content/v31/tutorial/
websites/staging/cayenne/trunk/content/v31/tutorial/css/
websites/staging/cayenne/trunk/content/v31/tutorial/css/cayenne-doc.css
websites/staging/cayenne/trunk/content/v31/tutorial/images/
websites/staging/cayenne/trunk/content/v31/tutorial/images/base-datamap.png (with props)
websites/staging/cayenne/trunk/content/v31/tutorial/images/base-datanode.png (with props)
websites/staging/cayenne/trunk/content/v31/tutorial/images/database-schema.jpg (with props)
websites/staging/cayenne/trunk/content/v31/tutorial/images/eclipse-generatedclasses.png (with props)
websites/staging/cayenne/trunk/content/v31/tutorial/images/eclipse-mvnrun.png (with props)
websites/staging/cayenne/trunk/content/v31/tutorial/images/eclipse-xmlfiles.png (with props)
websites/staging/cayenne/trunk/content/v31/tutorial/images/firefox-webapp.png (with props)
websites/staging/cayenne/trunk/content/v31/tutorial/images/maven-plugin-install.png (with props)
websites/staging/cayenne/trunk/content/v31/tutorial/images/modeler-artistid.png (with props)
websites/staging/cayenne/trunk/content/v31/tutorial/images/modeler-dbrelationship.png (with props)
websites/staging/cayenne/trunk/content/v31/tutorial/images/modeler-deleterule.png (with props)
websites/staging/cayenne/trunk/content/v31/tutorial/images/modeler-started.png (with props)
websites/staging/cayenne/trunk/content/v31/tutorial/images/tutorial-eclipse-project.png (with props)
websites/staging/cayenne/trunk/content/v31/tutorial/images/warning.gif (with props)
websites/staging/cayenne/trunk/content/v31/tutorial/index/
websites/staging/cayenne/trunk/content/v31/tutorial/index/ch01.html
websites/staging/cayenne/trunk/content/v31/tutorial/index/ch02.html
websites/staging/cayenne/trunk/content/v31/tutorial/index/ch03.html
websites/staging/cayenne/trunk/content/v31/tutorial/index/ch04.html
websites/staging/cayenne/trunk/content/v31/tutorial/index/ch05.html
websites/staging/cayenne/trunk/content/v31/tutorial/index/ch06.html
websites/staging/cayenne/trunk/content/v31/tutorial/index/ch07.html
websites/staging/cayenne/trunk/content/v31/tutorial/index/ch08.html
websites/staging/cayenne/trunk/content/v31/tutorial/index/ch09.html
websites/staging/cayenne/trunk/content/v31/tutorial/index/getting-started-part1.html
websites/staging/cayenne/trunk/content/v31/tutorial/index/getting-started-part2.html
websites/staging/cayenne/trunk/content/v31/tutorial/index/getting-started-part3.html
websites/staging/cayenne/trunk/content/v31/tutorial/index/getting-started-part4.html
websites/staging/cayenne/trunk/content/v31/tutorial/index/index.html
Modified:
websites/staging/cayenne/trunk/content/ (props changed)
Propchange: websites/staging/cayenne/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed Nov 7 11:39:02 2012
@@ -1 +1 @@
-1406568
+1406573
Added: websites/staging/cayenne/trunk/content/v31/tutorial/css/cayenne-doc.css
==============================================================================
(empty)
Added: websites/staging/cayenne/trunk/content/v31/tutorial/images/base-datamap.png
==============================================================================
Binary file - no diff available.
Propchange: websites/staging/cayenne/trunk/content/v31/tutorial/images/base-datamap.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: websites/staging/cayenne/trunk/content/v31/tutorial/images/base-datanode.png
==============================================================================
Binary file - no diff available.
Propchange: websites/staging/cayenne/trunk/content/v31/tutorial/images/base-datanode.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: websites/staging/cayenne/trunk/content/v31/tutorial/images/database-schema.jpg
==============================================================================
Binary file - no diff available.
Propchange: websites/staging/cayenne/trunk/content/v31/tutorial/images/database-schema.jpg
------------------------------------------------------------------------------
svn:mime-type = image/jpeg
Added: websites/staging/cayenne/trunk/content/v31/tutorial/images/eclipse-generatedclasses.png
==============================================================================
Binary file - no diff available.
Propchange: websites/staging/cayenne/trunk/content/v31/tutorial/images/eclipse-generatedclasses.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: websites/staging/cayenne/trunk/content/v31/tutorial/images/eclipse-mvnrun.png
==============================================================================
Binary file - no diff available.
Propchange: websites/staging/cayenne/trunk/content/v31/tutorial/images/eclipse-mvnrun.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: websites/staging/cayenne/trunk/content/v31/tutorial/images/eclipse-xmlfiles.png
==============================================================================
Binary file - no diff available.
Propchange: websites/staging/cayenne/trunk/content/v31/tutorial/images/eclipse-xmlfiles.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: websites/staging/cayenne/trunk/content/v31/tutorial/images/firefox-webapp.png
==============================================================================
Binary file - no diff available.
Propchange: websites/staging/cayenne/trunk/content/v31/tutorial/images/firefox-webapp.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: websites/staging/cayenne/trunk/content/v31/tutorial/images/maven-plugin-install.png
==============================================================================
Binary file - no diff available.
Propchange: websites/staging/cayenne/trunk/content/v31/tutorial/images/maven-plugin-install.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: websites/staging/cayenne/trunk/content/v31/tutorial/images/modeler-artistid.png
==============================================================================
Binary file - no diff available.
Propchange: websites/staging/cayenne/trunk/content/v31/tutorial/images/modeler-artistid.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: websites/staging/cayenne/trunk/content/v31/tutorial/images/modeler-dbrelationship.png
==============================================================================
Binary file - no diff available.
Propchange: websites/staging/cayenne/trunk/content/v31/tutorial/images/modeler-dbrelationship.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: websites/staging/cayenne/trunk/content/v31/tutorial/images/modeler-deleterule.png
==============================================================================
Binary file - no diff available.
Propchange: websites/staging/cayenne/trunk/content/v31/tutorial/images/modeler-deleterule.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: websites/staging/cayenne/trunk/content/v31/tutorial/images/modeler-started.png
==============================================================================
Binary file - no diff available.
Propchange: websites/staging/cayenne/trunk/content/v31/tutorial/images/modeler-started.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: websites/staging/cayenne/trunk/content/v31/tutorial/images/tutorial-eclipse-project.png
==============================================================================
Binary file - no diff available.
Propchange: websites/staging/cayenne/trunk/content/v31/tutorial/images/tutorial-eclipse-project.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: websites/staging/cayenne/trunk/content/v31/tutorial/images/warning.gif
==============================================================================
Binary file - no diff available.
Propchange: websites/staging/cayenne/trunk/content/v31/tutorial/images/warning.gif
------------------------------------------------------------------------------
svn:mime-type = image/gif
Added: websites/staging/cayenne/trunk/content/v31/tutorial/index/ch01.html
==============================================================================
--- websites/staging/cayenne/trunk/content/v31/tutorial/index/ch01.html (added)
+++ websites/staging/cayenne/trunk/content/v31/tutorial/index/ch01.html Wed Nov 7 11:39:02 2012
@@ -0,0 +1,15 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Chapter 1. Setup</title><link rel="stylesheet" type="text/css" href="css/cayenne-doc.css"><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"><link rel="home" href="index.html" title="Getting Started with Cayenne"><link rel="up" href="getting-started-part1.html" title="Part I. Setting up the environment"><link rel="prev" href="getting-started-part1.html" title="Part I. Setting up the environment"><link rel="next" href="getting-started-part2.html" title="Part II. Learning mapping basics"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 1. Setup</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="getting-started-part1.html">Prev</a> </td><th width="60%" align="center">Part I. Setting up the environment</th><td width="20%" a
lign="right"> <a accesskey="n" href="getting-started-part2.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 1. Setup"><div class="titlepage"><div><div><h2 class="title"><a name="d0e21"></a>Chapter 1. Setup</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="ch01.html#install-java">Install Java</a></span></dt><dt><span class="section"><a href="ch01.html#install-eclipse-and-maven">Install Eclipse IDE and the Maven Plugin</a></span></dt></dl></div><p> The goal of this chapter of the tutorial is to install (or check that you already have
+ installed) a minimally needed set of software to build a Cayenne application. </p><div class="section" title="Install Java"><div class="titlepage"><div><div><h2 class="title"><a name="install-java"></a>Install Java</h2></div></div></div><p>
+ Obviously, JDK has to be installed. Cayenne 3.1 requires JDK 1.5 or newer.
+ </p></div><div class="section" title="Install Eclipse IDE and the Maven Plugin"><div class="titlepage"><div><div><h2 class="title"><a name="install-eclipse-and-maven"></a>Install Eclipse IDE and the Maven Plugin</h2></div></div></div><p> Download Eclipse. This tutorial is based on the Galileo package (Eclipse 3.5), JEE
+ edition, still it should work with any recent vanilla Eclipse distribution. </p><p> After downloading Eclipse, unpack it somewhere in the filesystem, and start it. The
+ only plugin that you need for the tutorial is m2eclipse. To install it, in Eclipse go to
+ "Help > Install New Software", then click on "Add.." to add a new download site, and
+ enter "Maven" in the "Name" field, and "<span class="italic">http://m2eclipse.sonatype.org/sites/m2e</span>" in the "Location" field. You
+ may install any of the optional components that you think you need, but for this
+ tutorial we only select a few basic components as shown on the following screenshot: </p><p>
+ <span class="inlinemediaobject"><img src="images/maven-plugin-install.png"></span></p><p>
+ From here follow the Eclipse dialog instructions to finish the installation.
+ </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="getting-started-part1.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="getting-started-part1.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="getting-started-part2.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Part I. Setting up the environment </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Part II. Learning mapping basics</td></tr></table></div></body></html>
\ No newline at end of file
Added: websites/staging/cayenne/trunk/content/v31/tutorial/index/ch02.html
==============================================================================
--- websites/staging/cayenne/trunk/content/v31/tutorial/index/ch02.html (added)
+++ websites/staging/cayenne/trunk/content/v31/tutorial/index/ch02.html Wed Nov 7 11:39:02 2012
@@ -0,0 +1,73 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Chapter 2. Starting a project</title><link rel="stylesheet" type="text/css" href="css/cayenne-doc.css"><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"><link rel="home" href="index.html" title="Getting Started with Cayenne"><link rel="up" href="getting-started-part2.html" title="Part II. Learning mapping basics"><link rel="prev" href="getting-started-part2.html" title="Part II. Learning mapping basics"><link rel="next" href="ch03.html" title="Chapter 3. Getting started with Object Relational Mapping (ORM)"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 2. Starting a project</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="getting-started-part2.html">Prev</a> </td><th width="60%" align="center">Part II. Learning ma
pping basics</th><td width="20%" align="right"> <a accesskey="n" href="ch03.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 2. Starting a project"><div class="titlepage"><div><div><h2 class="title"><a name="d0e53"></a>Chapter 2. Starting a project</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="ch02.html#create-new-project">Create a new Project in Eclipse </a></span></dt><dt><span class="section"><a href="ch02.html#download-and-start-cayenne-modeler">Download and Start CayenneModeler</a></span></dt><dt><span class="section"><a href="ch02.html#create-new-mapping-project">Create a New Mapping Project in CayenneModeler</a></span></dt><dt><span class="section"><a href="ch02.html#create-datanode">Create a DataNode</a></span></dt><dt><span class="section"><a href="ch02.html#create-datamap">Create a DataMap</a></span></dt><dt><span class="section"><a href="ch02.html#s
ave-project">Save the Project</a></span></dt></dl></div><p>
+ The goal of this chapter is to create a new Java project in Eclipse
+ containing a basic Cayenne mapping. It presents an introduction to
+ CayenneModeler GUI tool, showing how to create the initial mapping
+ objects: DataDomain, DataNode, DataMap.
+ </p><div class="section" title="Create a new Project in Eclipse"><div class="titlepage"><div><div><h2 class="title"><a name="create-new-project"></a>Create a new Project in Eclipse </h2></div></div></div><p>
+ In Eclipse select "File > New > Other..." and then "Maven >
+ Maven Project". Click "Next". On the following screen check
+ "Create a simple project" checkbox and click "Next" again.
+ In the dialog shown on the screenshot below, fill the "Group Id"
+ and "Artifact Id" fields and click "Finish".
+ </p><p>
+ <span class="inlinemediaobject"><img src="images/tutorial-eclipse-project.png"></span>
+ </p><p>
+ Now you should have a new empty project in the Eclipse workspace.
+ Check that the project Java compiler settings are correct. Rightclick
+ on the "tutorial" project, select "Properties > Java Compiler" and
+ ensure that "Compiler compliance level" is at least "1.5"
+ (some versions of Maven plugin seem to be setting it to 1.4 by default).
+ </p></div><div class="section" title="Download and Start CayenneModeler"><div class="titlepage"><div><div><h2 class="title"><a name="download-and-start-cayenne-modeler"></a>Download and Start CayenneModeler</h2></div></div></div><p>
+ Although later in this tutorial we'll be using Maven to include Cayenne
+ runtime jars in the project, you'll still need to download Cayenne to
+ get access to the CayenneModeler tool.
+ </p><p>
+ </p><table border="1" id="d0e78"><col width="4%"><col width="96%"><tr>
+ <td valign="top">
+ <div class="mediaobject"><img src="images/warning.gif"></div>
+ </td>
+ <td>If you are really into Maven, you can start
+ CayenneModeler from Maven if you wish. We'll do it in a more traditional way
+ here.</td>
+ </tr></table><p>
+ </p><p> Download the latest release. Unpack the distribution somewhere in the file system and
+ start CayenneModeler, following platform-specific instructions. On most platforms it is
+ done simply by doubleclicking the Modeler icon. The welcome screen of the Modeler looks
+ like this: </p><p><span class="inlinemediaobject"><img src="images/modeler-started.png"></span></p></div><div class="section" title="Create a New Mapping Project in CayenneModeler"><div class="titlepage"><div><div><h2 class="title"><a name="create-new-mapping-project"></a>Create a New Mapping Project in CayenneModeler</h2></div></div></div><p>Click on the "New Project" button on Welcome screen. A new mapping project will appear
+ that contains a single <span class="bold"><strong>DataDomain</strong></span>. The meaning of a
+ DataDomain is explained elsewhere in the User Guide. For now it is sufficient to
+ understand that DataDomain is the root of your mapping project.</p></div><div class="section" title="Create a DataNode"><div class="titlepage"><div><div><h2 class="title"><a name="create-datanode"></a>Create a DataNode</h2></div></div></div><p>The next project object you will create is a <span class="bold"><strong>DataNode</strong></span>. DataNode is a descriptor of a single database your application
+ will connect to. Cayenne mapping project can use more than one database, but for now,
+ we'll only use one. With "project" selected on the left, click on "Create DataNode"
+ button on the toolbar (or select "Project > Create DataNode" from the menu.</p><p>A new DataNode is displayed. Now you need to specify JDBC connection parameters. For
+ an in-memory Derby database you can enter the following settings: </p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>JDBC Driver: org.apache.derby.jdbc.EmbeddedDriver</p></li><li class="listitem"><p>DB URL: jdbc:derby:memory:testdb;create=true</p></li></ul></div><p>
+ </p><table border="1" id="d0e127"><col width="4%"><col width="96%"><tr>
+ <td valign="top">
+ <div class="mediaobject"><img src="images/warning.gif"></div>
+ </td>
+ <td>We are creating an in-memory database here. So when
+ you stop your application, all the data will be lost. In most real-life
+ cases you'll be connecting to a database that actually persists its data on
+ disk, but an in-memory DB will do for the simple tutorial.</td>
+ </tr></table><p>
+ </p><p>Also you will need to change "Schema Update Strategy". Select
+ "org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy" from the dropdown, so that
+ Cayenne creates a new schema on Derby based on the ORM mapping when the application
+ starts.</p><p><span class="inlinemediaobject"><img src="images/base-datanode.png"></span></p></div><div class="section" title="Create a DataMap"><div class="titlepage"><div><div><h2 class="title"><a name="create-datamap"></a>Create a DataMap</h2></div></div></div><p>Now you will create a <span class="bold"><strong>DataMap</strong></span>. DataMap is an object
+ that holds all the mapping information. To create it, click on "Create DataMap" button
+ (or select a corresponding menu item). Note that the newly created DataMap is
+ automatically linked to the DataNode that you created in the previous step. If there is
+ more than one DataNode, you may need to link a DataMap to the correct node manually. In
+ other words a DataMap within DataDomain must point to a database described by the
+ map.</p><p>You can leave all the DataMap defaults unchanged except for one - "Java Package".
+ Enter "org.example.cayenne.persistent". This name will later be used for all persistent
+ classes.</p><p><span class="inlinemediaobject"><img src="images/base-datamap.png"></span></p></div><div class="section" title="Save the Project"><div class="titlepage"><div><div><h2 class="title"><a name="save-project"></a>Save the Project</h2></div></div></div><p>Before you proceed with the actual mapping, let's save the project. Click on "Save"
+ button in the toolbar and navigate to the "tutorial" Eclipse project folder that was
+ created earlier in this section and its "src/main/resources" subfolder and save the
+ project there. Now go back to Eclipse, right click on "tutorial" project and select
+ "Refresh", you will see three Cayenne XML files.</p><p><span class="inlinemediaobject"><img src="images/eclipse-xmlfiles.png"></span></p><p>Note that the location of the XML files is not coincidental. Cayenne runtime looks for
+ "cayenne-*.xml" file in the application CLASSPATH and "src/main/resources" folder should
+ already be a "class folder" in Eclipse for our project (and is also a standard location
+ that Maven would copy to a jar file, if we were using Maven from command-line).</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="getting-started-part2.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="getting-started-part2.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Part II. Learning mapping basics </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 3. Getting started with Object Relational Mapping (ORM)</td></tr></table></div></body></html>
\ No newline at end of file
Added: websites/staging/cayenne/trunk/content/v31/tutorial/index/ch03.html
==============================================================================
--- websites/staging/cayenne/trunk/content/v31/tutorial/index/ch03.html (added)
+++ websites/staging/cayenne/trunk/content/v31/tutorial/index/ch03.html Wed Nov 7 11:39:02 2012
@@ -0,0 +1,66 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Chapter 3. Getting started with Object Relational Mapping (ORM)</title><link rel="stylesheet" type="text/css" href="css/cayenne-doc.css"><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"><link rel="home" href="index.html" title="Getting Started with Cayenne"><link rel="up" href="getting-started-part2.html" title="Part II. Learning mapping basics"><link rel="prev" href="ch02.html" title="Chapter 2. Starting a project"><link rel="next" href="ch04.html" title="Chapter 4. Creating Java Classes"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 3. Getting started with Object Relational Mapping (ORM)</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02.html">Prev</a> </td><th width="60%" align="center">Part II. Learning ma
pping basics</th><td width="20%" align="right"> <a accesskey="n" href="ch04.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 3. Getting started with Object Relational Mapping (ORM)"><div class="titlepage"><div><div><h2 class="title"><a name="d0e175"></a>Chapter 3. Getting started with Object Relational Mapping (ORM)</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="ch03.html#mapping-db-tables-and-columns">Mapping Database Tables and Columns</a></span></dt><dt><span class="section"><a href="ch03.html#mapping-db-relationships">Mapping Database Relationships</a></span></dt><dt><span class="section"><a href="ch03.html#mapping-java-classes">Mapping Java Classes</a></span></dt></dl></div><p> The goal of this section is to learn how to create a simple Object-Relational model with
+ CayenneModeler. We will create a complete ORM model for the following database
+ schema:</p><p><span class="inlinemediaobject"><img src="images/database-schema.jpg"></span>
+ </p><p>
+ </p><table border="1" id="d0e187"><col width="4%"><col width="96%"><tr>
+ <td valign="top">
+ <div class="mediaobject"><img src="images/warning.gif"></div>
+ </td>
+ <td>Very often you'd have an existing database already, and
+ it can be quickly imported in Cayenne via "Tools > Reengineer Database
+ Schema". This will save you lots of time compared to manual mapping. However
+ understanding how to create the mapping by hand is important, so we are showing
+ the "manual" approach below.</td>
+ </tr></table><p>
+ </p><div class="section" title="Mapping Database Tables and Columns"><div class="titlepage"><div><div><h2 class="title"><a name="mapping-db-tables-and-columns"></a>Mapping Database Tables and Columns</h2></div></div></div><p>Lets go back to CayenneModeler where we have the newly created project open and start
+ by adding the ARTIST table. Database tables are called <span class="bold"><strong>"DbEntities"</strong></span> in Cayenne mapping (those can be actual tables or database
+ views). </p><p>Select "datamap" on the left-hand side project tree and click "Create DbEntity" button
+ (or use "Project > Create DbEntity" menu). A new DbEntity is created. In "DbEntity
+ Name" field enter "ARTIST". Then click on "Create Attribute" button on the entity
+ toolbar (third button from the left). This action changes the view to the "Attribute"
+ tab and adds a new attribute (attribute means a "table column" in this case) called
+ "untitledAttr". Let's rename it to ID, make it an INTEGER and make it a PK:</p><p><span class="inlinemediaobject"><img src="images/modeler-artistid.png"></span></p><p>Similarly add NAME VARCHAR(200) and DATE_OF_BIRTH DATE attributes. After that repeat
+ this procedure for PAINTING and GALLERY entities to match DB schema shown above.</p><p>
+ </p><table border="1" id="d0e221"><col width="4%"><col width="96%"><tr>
+ <td valign="top">
+ <div class="mediaobject"><img src="images/warning.gif"></div>
+ </td>
+ <td>Don't forget to save your project periodically to
+ avoid losing your work. You will also have to refresh the project in Eclipse
+ after every CayenneModeler save, as Eclipse is by default unaware of any
+ changes made in the Modeler.</td>
+ </tr></table><p>
+ </p></div><div class="section" title="Mapping Database Relationships"><div class="titlepage"><div><div><h2 class="title"><a name="mapping-db-relationships"></a>Mapping Database Relationships</h2></div></div></div><p>Now we need to specify relationships between ARTIST, PAINTING and GALLERY tables.
+ Start by creating a one-to-many ARTIST/PAINTING relationship:</p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>Select the ARTIST DbEntity on the left and click on the "Relationships"
+ tab.</p></li><li class="listitem"><p>Click on "Create Relationship" button on the entity toolbar (second button
+ from the left) - a relationship called "untitledRel" is created.</p></li><li class="listitem"><p>Choose the "Target" to be "Painting".</p></li><li class="listitem"><p>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".</p></li><li class="listitem"><p>Click on "Add" button on the right to add a join</p></li><li class="listitem"><p>Select "ID" column for the "Source" and "ARTIST_ID" column for the
+ target.</p></li><li class="listitem"><p>Relationship information should now look like this:</p></li></ul></div><p><span class="inlinemediaobject"><img src="images/modeler-dbrelationship.png"></span></p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>Click "Done" to confirm the changes and close the dialog.</p></li><li class="listitem"><p>Two complimentary relationships have been created - from ARTIST to PAINTING
+ and back. Still you may have noticed one thing is missing - "paintings"
+ relationship should be to-many, but "To Many" checkbox is not checked. Let's
+ change that - check the checkbox for "paintings" relationship, and then click on
+ PAINTING DbEntity, and uncheck "artist" relationship "To Many" to make the
+ reverse relationship "to-one" as it should be.</p></li><li class="listitem"><p>Repeat the steps above to create a many-to-one relationship from PAINTING to
+ GALLERY, calling the relationships pair "gallery" and "paintings".</p></li></ul></div></div><div class="section" title="Mapping Java Classes"><div class="titlepage"><div><div><h2 class="title"><a name="mapping-java-classes"></a>Mapping Java Classes</h2></div></div></div><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><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>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
+ "org.example.cayenne.persistent.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).</p></li><li class="listitem"><p>Select "GALLERY" DbEntity and click on "Create ObjEntity" button again -
+ you'll see a "Gallery" ObjEntity created.</p></li><li class="listitem"><p>Finally, do the same thing for "PAINTING".</p></li></ul></div><p>Now you need to synchronize relationships. Artist and Gallery entities were created
+ when there was no related "Painting" entity, so their relationships were not set. </p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>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.</p></li><li class="listitem"><p>Do the same for the "Gallery" entity.</p></li></ul></div><p>Unless you want to customize the Java class and property names (which you can do
+ easily) the mapping is complete. </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="getting-started-part2.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 2. Starting a project </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 4. Creating Java Classes</td></tr></table></div></body></html>
\ No newline at end of file
Added: websites/staging/cayenne/trunk/content/v31/tutorial/index/ch04.html
==============================================================================
--- websites/staging/cayenne/trunk/content/v31/tutorial/index/ch04.html (added)
+++ websites/staging/cayenne/trunk/content/v31/tutorial/index/ch04.html Wed Nov 7 11:39:02 2012
@@ -0,0 +1,53 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Chapter 4. Creating Java Classes</title><link rel="stylesheet" type="text/css" href="css/cayenne-doc.css"><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"><link rel="home" href="index.html" title="Getting Started with Cayenne"><link rel="up" href="getting-started-part2.html" title="Part II. Learning mapping basics"><link rel="prev" href="ch03.html" title="Chapter 3. Getting started with Object Relational Mapping (ORM)"><link rel="next" href="getting-started-part3.html" title="Part III. Learning Cayenne API"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 4. Creating Java Classes</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03.html">Prev</a> </td><th width="60%" align="center">Part II. Learning mapping basics<
/th><td width="20%" align="right"> <a accesskey="n" href="getting-started-part3.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 4. Creating Java Classes"><div class="titlepage"><div><div><h2 class="title"><a name="d0e305"></a>Chapter 4. Creating Java Classes</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="ch04.html#creating-java-classes">Creating Java Classes</a></span></dt></dl></div><p>Here we'll generate the Java classes from the model that was created in the previous
+ section. CayenneModeler can be used to also generate the database schema, but since we
+ specified "CreateIfNoSchemaStrategy" earlier when we created a DataNode, we'll skip the
+ database schema step. Still be aware that you can do it if you need to via "Tools >
+ Create Database Schema".
+ </p><div class="section" title="Creating Java Classes"><div class="titlepage"><div><div><h2 class="title"><a name="creating-java-classes"></a>Creating Java Classes</h2></div></div></div><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>Select "Tools > Generate Classes" menu.</p></li><li class="listitem"><p>For "Type" select "Standard Persistent Objects", if it is not already
+ selected.</p></li><li class="listitem"><p>For the "Output Directory" select "src/main/java" folder under your Eclipse
+ project folder (this is a "peer" location to the cayenne-*.xml location we
+ selected before).</p></li><li class="listitem"><p>Click on "Entities" tab and check the "Check All Classes" checkbox (unless it
+ is already checked and reads "Uncheck all Classes").</p></li><li class="listitem"><p>Click "Generate"</p></li></ul></div><p>Now go back to Eclipse, right click on "tutorial" project and select "Refresh" - you
+ should see pairs of classes generated for each mapped entity. You probably also see that
+ there's a bunch of red squiggles next to the newly generated Java classes in Eclipse.
+ This is because our project does not include Cayenne as a Maven dependency yet. Let's
+ fix it now by adding "cayenne-server" artifact in the bottom of the pom.xml file. The
+ resulting POM should look like
+ this:</p><pre class="programlisting"><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.example.cayenne</groupId>
+ <artifactId>tutorial</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.cayenne</groupId>
+ <artifactId>cayenne-server</artifactId>
+ <!-- Here specify the version of Cayenne you are actually using -->
+ <version>3.1M3</version>
+ </dependency>
+ </dependencies>
+</project></pre><p>Your computer must be connected to the internet. Once you save the pom.xml, Eclipse
+ will download the needed Cayenne jar file and add it to the project build path. As a
+ result, all the errors should disappear.</p><p><span class="inlinemediaobject"><img src="images/eclipse-generatedclasses.png"></span></p><p>Now let's check the entity class pairs. Each one is made of a superclass (e.g. Artist)
+ and a subclass (e.g. Artist). You <span class="bold"><strong>should not</strong></span> modify the
+ superclasses whose names start with "_" (underscore), as they will be replaced on
+ subsequent generator runs. Instead all custom logic should be placed in the subclasses
+ in "org.example.cayenne.persistent" package - those will never be overwritten by the
+ class generator.</p><p>
+ </p><table border="1" id="d0e346"><col width="4%"><col width="96%"><tr>
+ <td valign="top">
+ <div class="mediaobject"><img src="images/warning.gif"></div>
+ </td>
+ <td><span class="bold"><strong>Class Generation
+ Hint</strong></span> Often you'd start by generating classes from the
+ Modeler, but at the later stages of the project the generation is usually
+ automated either via Ant cgen task or Maven cgen mojo. All three methods are
+ interchangeable, however Ant and Maven methods would ensure that you never
+ forget to regenerate classes on mapping changes, as they are integrated into
+ the build cycle.</td>
+ </tr></table><p>
+ </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="getting-started-part2.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="getting-started-part3.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 3. Getting started with Object Relational Mapping (ORM) </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Part III. Learning Cayenne API</td></tr></table></div></body></html>
\ No newline at end of file
Added: websites/staging/cayenne/trunk/content/v31/tutorial/index/ch05.html
==============================================================================
--- websites/staging/cayenne/trunk/content/v31/tutorial/index/ch05.html (added)
+++ websites/staging/cayenne/trunk/content/v31/tutorial/index/ch05.html Wed Nov 7 11:39:02 2012
@@ -0,0 +1,59 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Chapter 5. Getting started with ObjectContext</title><link rel="stylesheet" type="text/css" href="css/cayenne-doc.css"><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"><link rel="home" href="index.html" title="Getting Started with Cayenne"><link rel="up" href="getting-started-part3.html" title="Part III. Learning Cayenne API"><link rel="prev" href="getting-started-part3.html" title="Part III. Learning Cayenne API"><link rel="next" href="ch06.html" title="Chapter 6. Getting started with persistent objects"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 5. Getting started with ObjectContext</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="getting-started-part3.html">Prev</a> </td><th width="60%" align="center">Part III.&
nbsp;Learning Cayenne API</th><td width="20%" align="right"> <a accesskey="n" href="ch06.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 5. Getting started with ObjectContext"><div class="titlepage"><div><div><h2 class="title"><a name="d0e369"></a>Chapter 5. Getting started with ObjectContext</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="ch05.html#creating-main-class">Creating the Main Class</a></span></dt><dt><span class="section"><a href="ch05.html#runnning-app">Running Application</a></span></dt></dl></div><p>In this section we'll write a simple main class to run our application, and get a brief
+ introduction to Cayenne ObjectContext.</p><div class="section" title="Creating the Main Class"><div class="titlepage"><div><div><h2 class="title"><a name="creating-main-class"></a>Creating the Main Class</h2></div></div></div><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>In Eclipse create a new class called "Main" in the "org.example.cayenne"
+ package.</p></li><li class="listitem"><p>Create a standard "main" method to make it a runnable
+ class:</p><pre class="programlisting">package org.example.cayenne;
+
+public class Main {
+
+ public static void main(String[] args) {
+
+ }
+}</pre></li><li class="listitem"><p>The first thing you need to be able to access the database is to create a
+ ServerRuntime object (which is essentially a wrapper around Cayenne stack) and
+ use it to obtain an instance of an
+ ObjectContext.</p><pre class="programlisting">package org.example.cayenne;
+
+import org.apache.cayenne.ObjectContext;
+import org.apache.cayenne.configuration.server.ServerRuntime;
+
+public class Main {
+
+ public static void main(String[] args) {
+ ServerRuntime cayenneRuntime = new ServerRuntime(
+ "cayenne-project.xml");
+ ObjectContext context = cayenneRuntime.getContext();
+ }
+}</pre><p>ObjectContext is an isolated "session" in Cayenne that provides all needed API
+ to work with data. ObjectContext has methods to execute queries and manage
+ persistent objects. We'll discuss them in the following sections. When the first
+ ObjectContext is created in the application, Cayenne loads XML mapping files and
+ creates a shared access stack that is later reused by other ObjectContexts.
+ </p></li></ul></div></div><div class="section" title="Running Application"><div class="titlepage"><div><div><h2 class="title"><a name="runnning-app"></a>Running Application</h2></div></div></div><p>Let's check what happens when you run the application. But before we do that we need
+ to add another dependency to the pom.xml - Apache Derby, our embedded database engine.
+ The following piece of XML needs to be added to the
+ <dependencies>...</dependencies> section, where we already have Cayenne
+ jars:</p><pre class="programlisting"><dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.8.1.2</version>
+</dependency></pre><p>Now
+ we are ready to run. Right click the "Main" class in Eclipse and select "Run As >
+ Java Application". In the console you'll see output similar to this, indicating that
+ Cayenne stack has been
+ started:</p><pre class="programlisting">INFO: Loading XML configuration resource from file:cayenne-project.xml
+INFO: loading user name and password.
+INFO: Created connection pool: jdbc:derby:memory:testdb;create=true
+ Driver class: org.apache.derby.jdbc.EmbeddedDriver
+ Min. connections in the pool: 1
+ Max. connections in the pool: 1</pre><table border="1" id="d0e403"><col width="4%"><col width="96%"><tr>
+ <td valign="top">
+ <div class="mediaobject"><img src="images/warning.gif"></div>
+ </td>
+ <td><span class="bold"><strong>How to Configure Cayenne
+ Logging</strong></span> You can tweak more or less detailed output by
+ following the instructions in the logging chapter.</td>
+ </tr></table><p>Nothing much happened here, but we've been able to create a working
+ Cayenne stack. In the following chapters we'll use the ObjectContext for more
+ interesting things.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="getting-started-part3.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="getting-started-part3.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch06.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Part III. Learning Cayenne API </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 6. Getting started with persistent objects</td></tr></table></div></body></html>
\ No newline at end of file
Added: websites/staging/cayenne/trunk/content/v31/tutorial/index/ch06.html
==============================================================================
--- websites/staging/cayenne/trunk/content/v31/tutorial/index/ch06.html (added)
+++ websites/staging/cayenne/trunk/content/v31/tutorial/index/ch06.html Wed Nov 7 11:39:02 2012
@@ -0,0 +1,106 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Chapter 6. Getting started with persistent objects</title><link rel="stylesheet" type="text/css" href="css/cayenne-doc.css"><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"><link rel="home" href="index.html" title="Getting Started with Cayenne"><link rel="up" href="getting-started-part3.html" title="Part III. Learning Cayenne API"><link rel="prev" href="ch05.html" title="Chapter 5. Getting started with ObjectContext"><link rel="next" href="ch07.html" title="Chapter 7. Selecting Objects"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 6. Getting started with persistent objects</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch05.html">Prev</a> </td><th width="60%" align="center">Part III. Learning Cayenne API</th><
td width="20%" align="right"> <a accesskey="n" href="ch07.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 6. Getting started with persistent objects"><div class="titlepage"><div><div><h2 class="title"><a name="d0e422"></a>Chapter 6. Getting started with persistent objects</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="ch06.html#customizing-persistent-objects">Inspecting and Customizing Persistent Objects</a></span></dt><dt><span class="section"><a href="ch06.html#create-new-objects">Create New Objects</a></span></dt></dl></div><p>In this chapter we'll learn about persistent objects, how to customize them and how to
+ create and save them in DB.</p><div class="section" title="Inspecting and Customizing Persistent Objects"><div class="titlepage"><div><div><h2 class="title"><a name="customizing-persistent-objects"></a>Inspecting and Customizing Persistent Objects</h2></div></div></div><p>Persistent classes in Cayenne implement a DataObject interface. If you inspect any of
+ the classes generated earlier in this tutorial (e.g.
+ org.example.cayenne.persistent.Artist), you'll see that it extends a class with the name
+ that starts with underscore (org.example.cayenne.persistent.auto._Artist), which in turn
+ extends from org.apache.cayenne.CayenneDataObject. Splitting each persistent class into
+ user-customizable subclass (Xyz) and a generated superclass (_Xyz) is a useful technique
+ to avoid overwriting the custom code when refreshing classes from the mapping
+ model.</p><p>Let's for instance add a utility method to the Artist class that sets Artist date of
+ birth, taking a string argument for the date. It will be preserved even if the model
+ changes later:</p><pre class="programlisting">package org.example.cayenne.persistent;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.example.cayenne.persistent.auto._Artist;
+
+public class Artist extends _Artist {
+
+ static final String DEFAULT_DATE_FORMAT = "yyyyMMdd";
+
+ /**
+ * Sets date of birth using a string in format yyyyMMdd.
+ */
+ public void setDateOfBirthString(String yearMonthDay) {
+ if (yearMonthDay == null) {
+ setDateOfBirth(null);
+ } else {
+
+ Date date;
+ try {
+ date = new SimpleDateFormat(DEFAULT_DATE_FORMAT)
+ .parse(yearMonthDay);
+ } catch (ParseException e) {
+ throw new IllegalArgumentException(
+ "A date argument must be in format '"
+ + DEFAULT_DATE_FORMAT + "': " + yearMonthDay);
+ }
+
+ setDateOfBirth(date);
+ }
+ }
+}</pre></div><div class="section" title="Create New Objects"><div class="titlepage"><div><div><h2 class="title"><a name="create-new-objects"></a>Create New Objects</h2></div></div></div><p>Now we'll create a bunch of objects and save them to the database. An object is
+ created and registered with ObjectContext using "newObject" method. Objects <span class="bold"><strong>must</strong></span> be registered with DataContext to be persisted and to
+ allow setting relationships with other objects. Add this code to the "main" method of
+ the Main class:</p><pre class="programlisting">Artist picasso = context.newObject(Artist.class);
+picasso.setName("Pablo Picasso");
+picasso.setDateOfBirthString("18811025");</pre><p>Note that at this point "picasso" object is only stored in memory and is not saved in
+ the database. Let's continue by adding a Metropolitan Museum "Gallery" object and a few
+ Picasso "Paintings":</p><pre class="programlisting">Gallery metropolitan = context.newObject(Gallery.class);
+metropolitan.setName("Metropolitan Museum of Art");
+
+Painting girl = context.newObject(Painting.class);
+girl.setName("Girl Reading at a Table");
+
+Painting stein = context.newObject(Painting.class);
+stein.setName("Gertrude Stein");</pre><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.
+ picasso.addToPaintings(girl) has exactly the same effect as
+ girl.setToArtist(picasso)).</p><pre class="programlisting">picasso.addToPaintings(girl);
+picasso.addToPaintings(stein);
+
+girl.setGallery(metropolitan);
+stein.setGallery(metropolitan);</pre><p>Now lets save all five new objects, in a single method call:</p><pre class="programlisting">context.commitChanges();</pre><p>Now you can run the application again as described in the previous chapter. The new
+ output will show a few actual DB operations:</p><pre class="programlisting">org.apache.cayenne.configuration.XMLDataChannelDescriptorLoader load
+INFO: Loading XML configuration resource from file:cayenne-project.xml
+...
+INFO: Opening connection: jdbc:derby:memory:testdb;create=true
+ Login: null
+ Password: *******
+INFO: +++ Connecting: SUCCESS.
+INFO: Detected and installed adapter: org.apache.cayenne.dba.derby.DerbyAdapter
+INFO: --- transaction started.
+INFO: No schema detected, will create mapped tables
+INFO: CREATE TABLE GALLERY (ID INTEGER NOT NULL, NAME VARCHAR (200), PRIMARY KEY (ID))
+INFO: CREATE TABLE ARTIST (DATE_OF_BIRTH DATE, ID INTEGER NOT NULL, NAME VARCHAR (200), PRIMARY KEY (ID))
+INFO: CREATE TABLE PAINTING (ARTIST_ID INTEGER, GALLERY_ID INTEGER, ID INTEGER NOT NULL,
+ NAME VARCHAR (200), PRIMARY KEY (ID))
+INFO: ALTER TABLE PAINTING ADD FOREIGN KEY (ARTIST_ID) REFERENCES ARTIST (ID)
+INFO: ALTER TABLE PAINTING ADD FOREIGN KEY (GALLERY_ID) REFERENCES GALLERY (ID)
+INFO: CREATE TABLE AUTO_PK_SUPPORT (
+ TABLE_NAME CHAR(100) NOT NULL, NEXT_ID BIGINT NOT NULL, PRIMARY KEY(TABLE_NAME))
+INFO: DELETE FROM AUTO_PK_SUPPORT WHERE TABLE_NAME IN ('ARTIST', 'GALLERY', 'PAINTING')
+INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('ARTIST', 200)
+INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('GALLERY', 200)
+INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('PAINTING', 200)
+INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'ARTIST']
+INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'GALLERY']
+INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'PAINTING']
+INFO: INSERT INTO GALLERY (ID, NAME) VALUES (?, ?)
+INFO: [batch bind: 1->ID:200, 2->NAME:'Metropolitan Museum of Art']
+INFO: === updated 1 row.
+INFO: INSERT INTO ARTIST (DATE_OF_BIRTH, ID, NAME) VALUES (?, ?, ?)
+INFO: [batch bind: 1->DATE_OF_BIRTH:'1881-10-25 00:00:00.0', 2->ID:200, 3->NAME:'Pablo Picasso']
+INFO: === updated 1 row.
+INFO: INSERT INTO PAINTING (ARTIST_ID, GALLERY_ID, ID, NAME) VALUES (?, ?, ?, ?)
+INFO: [batch bind: 1->ARTIST_ID:200, 2->GALLERY_ID:200, 3->ID:200, 4->NAME:'Gertrude Stein']
+INFO: [batch bind: 1->ARTIST_ID:200, 2->GALLERY_ID:200, 3->ID:201, 4->NAME:'Girl Reading at a Table']
+INFO: === updated 2 rows.
+INFO: +++ transaction committed.
+</pre><p>So first Cayenne creates the needed tables (remember, we used
+ "CreateIfNoSchemaStrategy"). Then it runs a number of inserts, generating primary keys
+ on the fly. Not bad for just a few lines of code.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch05.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="getting-started-part3.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch07.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 5. Getting started with ObjectContext </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 7. Selecting Objects</td></tr></table></div></body></html>
\ No newline at end of file
Added: websites/staging/cayenne/trunk/content/v31/tutorial/index/ch07.html
==============================================================================
--- websites/staging/cayenne/trunk/content/v31/tutorial/index/ch07.html (added)
+++ websites/staging/cayenne/trunk/content/v31/tutorial/index/ch07.html Wed Nov 7 11:39:02 2012
@@ -0,0 +1,24 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Chapter 7. Selecting Objects</title><link rel="stylesheet" type="text/css" href="css/cayenne-doc.css"><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"><link rel="home" href="index.html" title="Getting Started with Cayenne"><link rel="up" href="getting-started-part3.html" title="Part III. Learning Cayenne API"><link rel="prev" href="ch06.html" title="Chapter 6. Getting started with persistent objects"><link rel="next" href="ch08.html" title="Chapter 8. Deleting Objects"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 7. Selecting Objects</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch06.html">Prev</a> </td><th width="60%" align="center">Part III. Learning Cayenne API</th><td width="20%" align="right"> <a ac
cesskey="n" href="ch08.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 7. Selecting Objects"><div class="titlepage"><div><div><h2 class="title"><a name="d0e465"></a>Chapter 7. Selecting Objects</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="ch07.html#introducing-select-query">Introducing SelectQuery</a></span></dt></dl></div><p>This chapter shows how to select objects from the database using SelectQuery. </p><div class="section" title="Introducing SelectQuery"><div class="titlepage"><div><div><h2 class="title"><a name="introducing-select-query"></a>Introducing SelectQuery</h2></div></div></div><p>It was shown before how to persist new objects. Cayenne queries are used to access
+ already saved objects. The primary query type used for selecting objects is <span class="italic">SelectQuery</span>. It can be mapped in CayenneModeler or created
+ via the API. We'll use the later approach in this section. We don't have too much data
+ in the database yet, but we can still demonstrate the main principles below.</p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>Select all paintings (the code, and the log output it generates):</p></li></ul></div><pre class="programlisting">SelectQuery select1 = new SelectQuery(Painting.class);
+List paintings1 = context.performQuery(select1);</pre><pre class="programlisting">INFO: SELECT t0.GALLERY_ID, t0.ARTIST_ID, t0.NAME, t0.ID FROM PAINTING t0
+INFO: === returned 2 rows. - took 18 ms.</pre><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>Select paintings that start with "gi", ignoring case:</p></li></ul></div><pre class="programlisting">Expression qualifier2 = ExpressionFactory.likeIgnoreCaseExp(
+ Painting.NAME_PROPERTY,
+ "gi%");
+SelectQuery select2 = new SelectQuery(Painting.class, qualifier2);
+List paintings2 = context.performQuery(select2);</pre><pre class="programlisting">INFO: SELECT t0.GALLERY_ID, t0.NAME, t0.ARTIST_ID, t0.ID FROM PAINTING t0 WHERE UPPER(t0.NAME) LIKE UPPER(?)
+ [bind: 1->NAME:'gi%'] - prepared in 6 ms.
+INFO: === returned 1 row. - took 18 ms.</pre><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>Select all paintings done by artists who were born more than a 100 years ago
+ (demonstrating using Expression.fromString(..) instead of
+ ExpressionFactory):</p></li></ul></div><pre class="programlisting">Calendar c = new GregorianCalendar();
+c.set(c.get(Calendar.YEAR) - 100, 0, 1, 0, 0, 0);
+
+Expression qualifier3 = Expression.fromString("artist.dateOfBirth < $date");
+qualifier3 = qualifier3.expWithParameters(Collections.singletonMap("date", c.getTime()));
+SelectQuery select3 = new SelectQuery(Painting.class, qualifier3);
+List paintings3 = context.performQuery(select3);</pre><pre class="programlisting">INFO: SELECT t0.GALLERY_ID, t0.NAME, t0.ARTIST_ID, t0.ID FROM PAINTING t0 JOIN ARTIST t1 ON (t0.ARTIST_ID = t1.ID)
+ WHERE t1.DATE_OF_BIRTH < ? [bind: 1->DATE_OF_BIRTH:'1911-01-01 00:00:00.493'] - prepared in 7 ms.
+INFO: === returned 2 rows. - took 25 ms.</pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch06.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="getting-started-part3.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch08.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 6. Getting started with persistent objects </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 8. Deleting Objects</td></tr></table></div></body></html>
\ No newline at end of file
Added: websites/staging/cayenne/trunk/content/v31/tutorial/index/ch08.html
==============================================================================
--- websites/staging/cayenne/trunk/content/v31/tutorial/index/ch08.html (added)
+++ websites/staging/cayenne/trunk/content/v31/tutorial/index/ch08.html Wed Nov 7 11:39:02 2012
@@ -0,0 +1,32 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Chapter 8. Deleting Objects</title><link rel="stylesheet" type="text/css" href="css/cayenne-doc.css"><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"><link rel="home" href="index.html" title="Getting Started with Cayenne"><link rel="up" href="getting-started-part3.html" title="Part III. Learning Cayenne API"><link rel="prev" href="ch07.html" title="Chapter 7. Selecting Objects"><link rel="next" href="getting-started-part4.html" title="Part IV. Converting to Web Application"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 8. Deleting Objects</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch07.html">Prev</a> </td><th width="60%" align="center">Part III. Learning Cayenne API</th><td width="20%" align="right"> <
a accesskey="n" href="getting-started-part4.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 8. Deleting Objects"><div class="titlepage"><div><div><h2 class="title"><a name="d0e503"></a>Chapter 8. Deleting Objects</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="ch08.html#setup-delete-rules">Setting Up Delete Rules</a></span></dt><dt><span class="section"><a href="ch08.html#deleting-objects">Deleting Objects</a></span></dt></dl></div><p>This chapter explains how to model relationship delete rules and how to delete individual
+ objects as well as sets of objects. Also demonstrated the use of Cayenne class to run a
+ query.</p><div class="section" title="Setting Up Delete Rules"><div class="titlepage"><div><div><h2 class="title"><a name="setup-delete-rules"></a>Setting Up Delete Rules</h2></div></div></div><p>Before we discuss the API for object deletion, lets go back to CayenneModeler and set
+ up some delete rules. Doing this is optional but will simplify correct handling of the
+ objects related to deleted objects.</p><p>In the Modeler go to "Artist" ObjEntity, "Relationships" tab and select "Cascade" for
+ the "paintings" relationship delete rule:</p><p><span class="inlinemediaobject"><img src="images/modeler-deleterule.png"></span>
+ </p><p>Repeat this step for other relationships:</p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>For Gallery set "paintings" relationship to be "Nullify", as a painting can
+ exist without being displayed in a gallery.</p></li><li class="listitem"><p>For Painting et both relationships rules to "Nullify".</p></li></ul></div><p>Now save the mapping, and refresh the project in Eclispe.</p></div><div class="section" title="Deleting Objects"><div class="titlepage"><div><div><h2 class="title"><a name="deleting-objects"></a>Deleting Objects</h2></div></div></div><p>While deleting objects is possible via SQL, qualifying a delete on one or more IDs, a
+ more common way in Cayenne (or ORM in general) is to get a hold of the object first, and
+ then delete it via the context. Let's use utility class Cayenne to find an
+ artist:</p><pre class="programlisting">Expression qualifier = ExpressionFactory.matchExp(Artist.NAME_PROPERTY, "Pablo Picasso");
+SelectQuery select = new SelectQuery(Artist.class, qualifier);
+Artist picasso = (Artist) Cayenne.objectForQuery(context, select);</pre><p>Now let's delete the artist:</p><pre class="programlisting">if (picasso != null) {
+ context.deleteObject(picasso);
+ context.commitChanges();
+}</pre><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><pre class="programlisting">INFO: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0
+ WHERE t0.NAME = ? [bind: 1->NAME:'Pablo Picasso'] - prepared in 6 ms.
+INFO: === returned 1 row. - took 18 ms.
+INFO: +++ transaction committed.
+INFO: --- transaction started.
+INFO: DELETE FROM PAINTING WHERE ID = ?
+INFO: [batch bind: 1->ID:200]
+INFO: [batch bind: 1->ID:201]
+INFO: === updated 2 rows.
+INFO: DELETE FROM ARTIST WHERE ID = ?
+INFO: [batch bind: 1->ID:200]
+INFO: === updated 1 row.
+INFO: +++ transaction committed.</pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch07.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="getting-started-part3.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="getting-started-part4.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 7. Selecting Objects </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Part IV. Converting to Web Application</td></tr></table></div></body></html>
\ No newline at end of file
Added: websites/staging/cayenne/trunk/content/v31/tutorial/index/ch09.html
==============================================================================
--- websites/staging/cayenne/trunk/content/v31/tutorial/index/ch09.html (added)
+++ websites/staging/cayenne/trunk/content/v31/tutorial/index/ch09.html Wed Nov 7 11:39:02 2012
@@ -0,0 +1,205 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Chapter 9. Converting to Web Application</title><link rel="stylesheet" type="text/css" href="css/cayenne-doc.css"><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"><link rel="home" href="index.html" title="Getting Started with Cayenne"><link rel="up" href="getting-started-part4.html" title="Part IV. Converting to Web Application"><link rel="prev" href="getting-started-part4.html" title="Part IV. Converting to Web Application"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 9. Converting to Web Application</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="getting-started-part4.html">Prev</a> </td><th width="60%" align="center">Part IV. Converting to Web Application</th><td width="20%" align="right"> </td></tr></table><hr><
/div><div class="chapter" title="Chapter 9. Converting to Web Application"><div class="titlepage"><div><div><h2 class="title"><a name="d0e550"></a>Chapter 9. Converting to Web Application</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="ch09.html#converting-to-webapp">Converting Tutorial to a Web Application</a></span></dt><dt><span class="section"><a href="ch09.html#running-webapp">Running Web Application</a></span></dt></dl></div><p>This chapter shows how to work with Cayenne in a web application.</p><div class="section" title="Converting Tutorial to a Web Application"><div class="titlepage"><div><div><h2 class="title"><a name="converting-to-webapp"></a>Converting Tutorial to a Web Application</h2></div></div></div><p>The web part of the web application tutorial is done in JSP, which is the least common
+ denominator of the Java web technologies, and is intentionally simplistic from the UI
+ perspective, to concentrate on Cayenne integration aspect, rather than the interface. A
+ typical Cayenne web application works like this:</p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>Cayenne configuiration is loaded when an application context is started, using
+ a special servlet filter.</p></li><li class="listitem"><p>User requests are intercepted by the filter, and the DataContext is bound to
+ the request thread, so the application can access it easily from
+ anywhere.</p></li><li class="listitem"><p>The same DataContext instance is reused within a single user session;
+ different sessions use different DataContexts (and therefore different sets of
+ objects). <span class="italic">The context can be scoped differently
+ depending on the app specifics. For the tutorial we'll be using a
+ session-scoped context.</span></p></li></ul></div><p>So let's convert the tutorial that we created to a web application:</p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>In Eclipse under "tutorial" project folder create a new folder
+ "src/main/webapp/WEB-INF".</p></li><li class="listitem"><p>Under "WEB-INF" create a new file "web.xml" (a standard web app descriptor): </p><p>
+ <span class="bold"><strong>web.xml</strong></span>
+ </p><pre class="programlisting"><?xml version="1.0" encoding="utf-8"?>
+ <!DOCTYPE web-app
+ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+ <display-name>Cayenne Tutorial</display-name>
+
+ <!-- This filter bootstraps ServerRuntime and then provides each request thread
+ with a session-bound DataContext. Note that the name of the filter is important,
+ as it points it to the right named configuration file.
+ -->
+ <filter>
+ <filter-name>cayenne-project</filter-name>
+ <filter-class>org.apache.cayenne.configuration.web.CayenneFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>cayenne-project</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+ <welcome-file-list>
+ <welcome-file>index.jsp</welcome-file>
+ </welcome-file-list>
+</web-app></pre></li><li class="listitem"><p>Create the artist browser page src/main/webapp/index.jsp file with the
+ following contents: </p><p><span class="bold"><strong>webapp/index.jsp</strong></span>
+ </p><pre class="programlisting"><%@ page language="java" contentType="text/html" %>
+<%@ page import="org.example.cayenne.persistent.*" %>
+<%@ page import="org.apache.cayenne.*" %>
+<%@ page import="org.apache.cayenne.query.*" %>
+<%@ page import="org.apache.cayenne.exp.*" %>
+<%@ page import="java.util.*" %>
+
+<%
+ SelectQuery query = new SelectQuery(Artist.class);
+ query.addOrdering(Artist.NAME_PROPERTY, SortOrder.ASCENDING);
+
+ ObjectContext context = BaseContext.getThreadObjectContext();
+ List<Artist> artists = context.performQuery(query);
+%>
+<html>
+ <head>
+ <title>Main</title>
+ </head>
+ <body>
+ <h2>Artists:</h2>
+
+ <% if(artists.isEmpty()) {%>
+ <p>No artists found</p>
+ <% } else {
+ for(Artist a : artists) {
+ %>
+ <p><a href="detail.jsp?id=<%=Cayenne.intPKForObject(a)%>"> <%=a.getName()%> </a></p>
+ <%
+ }
+ } %>
+ <hr>
+ <p><a href="detail.jsp">Create new artist...</a></p>
+ </body>
+</html> </pre></li><li class="listitem"><p>Create the artist editor page src/main/webapp/detail.jsp with the following
+ content: </p><p><span class="bold"><strong>webapp/detail.jsp</strong></span>
+ </p><pre class="programlisting"><%@ page language="java" contentType="text/html" %>
+<%@ page import="org.example.cayenne.persistent.*" %>
+<%@ page import="org.apache.cayenne.*" %>
+<%@ page import="java.util.*" %>
+<%@ page import="java.text.*" %>
+
+<%
+ ObjectContext context = BaseContext.getThreadObjectContext();
+ String id = request.getParameter("id");
+
+ // find artist for id
+ Artist artist = null;
+ if(id != null && id.trim().length() > 0) {
+ artist = Cayenne.objectForPK(context, Artist.class, Integer.parseInt(id));
+ }
+
+ if("POST".equals(request.getMethod())) {
+ // if no id is saved in the hidden field, we are dealing with
+ // create new artist request
+ if(artist == null) {
+ artist = context.newObject(Artist.class);
+ }
+
+ // note that in a real application we would so dome validation ...
+ // here we just hope the input is correct
+ artist.setName(request.getParameter("name"));
+ artist.setDateOfBirthString(request.getParameter("dateOfBirth"));
+
+ context.commitChanges();
+
+ response.sendRedirect("index.jsp");
+ }
+
+ if(artist == null) {
+ // create transient artist for the form response rendering
+ artist = new Artist();
+ }
+
+ String name = artist.getName() == null ? "" : artist.getName();
+ String dob = artist.getDateOfBirth() == null
+ ? "" : new SimpleDateFormat("yyyyMMdd").format(artist.getDateOfBirth());
+%>
+<html>
+ <head>
+ <title>Artist Details</title>
+ </head>
+ <body>
+ <h2>Artists Details</h2>
+ <form name="EditArtist" action="detail.jsp" method="POST">
+ <input type="hidden" name="id" value="<%= id != null ? id : "" %>" />
+ <table border="0">
+ <tr>
+ <td>Name:</td>
+ <td><input type="text" name="name" value="<%= name %>"/></td>
+ </tr>
+ <tr>
+ <td>Date of Birth (yyyyMMdd):</td>
+ <td><input type="text" name="dateOfBirth" value="<%= dob %>"/></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td align="right"><input type="submit" value="Save" /></td>
+ </tr>
+ </table>
+ </form>
+ </body>
+</html></pre></li></ul></div></div><div class="section" title="Running Web Application"><div class="titlepage"><div><div><h2 class="title"><a name="running-webapp"></a>Running Web Application</h2></div></div></div><p>To run the web application we'll use "maven-jetty-plugin". To activate it, let's add
+ the following piece of code to the "pom.xml" file, following the "dependencies" section
+ and save the POM:</p><pre class="programlisting"><build>
+ <plugins>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.22</version>
+ </plugin>
+ </plugins>
+</build></pre><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>Go to "Run > Run Configurations..." menu, select "Maven Build", right click
+ and select "New"</p></li><li class="listitem"><p>Make sure you fill "Name", "Base directory" and "Goals" fields as shown on the
+ screenshot:</p><p><span class="inlinemediaobject"><img src="images/eclipse-mvnrun.png"></span></p></li></ul></div><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>Click "Apply" and "Run". On the first execution it may take a few minutes for
+ Jetty plugin to download all dependencies, but eventually you'll see the logs
+ like this:</p><pre class="programlisting">[INFO] Scanning for projects...
+[INFO]
+[INFO] ------------------------------------------------------------------------
+[INFO] Building tutorial 0.0.1-SNAPSHOT
+[INFO] ------------------------------------------------------------------------
+...
+[INFO] Configuring Jetty for project: tutorial
+[INFO] Webapp source directory = /.../tutorial/src/main/webapp
+[INFO] Reload Mechanic: automatic
+[INFO] Classes = /.../tutorial/target/classes
+[INFO] Context path = /tutorial
+[INFO] Tmp directory = determined at runtime
+[INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml
+[INFO] Web overrides = none
+[INFO] web.xml file = /.../tutorial/src/main/webapp/WEB-INF/web.xml
+[INFO] Webapp directory = /.../tutorial/src/main/webapp
+[INFO] Starting jetty 6.1.22 ...
+INFO::jetty-6.1.22
+INFO::No Transaction manager found - if your webapp requires one, please configure one.
+INFO::Started SelectChannelConnector@0.0.0.0:8080
+[INFO] Started Jetty Server</pre></li></ul></div><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>So the Jetty container just started.</p></li><li class="listitem"><p>Now go to <span class="italic">http://localhost:8080/tutorial/</span>
+ URL. You should see "No artists found message" in the web browser and
+ the following output in the Eclipse console:</p><pre class="programlisting">INFO: Loading XML configuration resource from file:/.../tutorial/target/classes/cayenne-project.xml
+INFO: loading user name and password.
+INFO: Created connection pool: jdbc:derby:memory:testdb;create=true
+ Driver class: org.apache.derby.jdbc.EmbeddedDriver
+ Min. connections in the pool: 1
+ Max. connections in the pool: 1
+INFO: Opening connection: jdbc:derby:memory:testdb;create=true
+ Login: null
+ Password: *******
+INFO: +++ Connecting: SUCCESS.
+INFO: Detected and installed adapter: org.apache.cayenne.dba.derby.DerbyAdapter
+INFO: --- transaction started.
+INFO: No schema detected, will create mapped tables
+INFO: CREATE TABLE GALLERY (ID INTEGER NOT NULL, NAME VARCHAR (200), PRIMARY KEY (ID))
+INFO: CREATE TABLE ARTIST (DATE_OF_BIRTH DATE, ID INTEGER NOT NULL, NAME VARCHAR (200), PRIMARY KEY (ID))
+INFO: CREATE TABLE PAINTING (ARTIST_ID INTEGER, GALLERY_ID INTEGER, ID INTEGER NOT NULL,
+ NAME VARCHAR (200), PRIMARY KEY (ID))
+INFO: ALTER TABLE PAINTING ADD FOREIGN KEY (ARTIST_ID) REFERENCES ARTIST (ID)
+INFO: ALTER TABLE PAINTING ADD FOREIGN KEY (GALLERY_ID) REFERENCES GALLERY (ID)
+INFO: CREATE TABLE AUTO_PK_SUPPORT (
+ TABLE_NAME CHAR(100) NOT NULL, NEXT_ID BIGINT NOT NULL, PRIMARY KEY(TABLE_NAME))
+INFO: DELETE FROM AUTO_PK_SUPPORT WHERE TABLE_NAME IN ('ARTIST', 'GALLERY', 'PAINTING')
+INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('ARTIST', 200)
+INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('GALLERY', 200)
+INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('PAINTING', 200)
+INFO: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0 ORDER BY t0.NAME - prepared in 43 ms.
+INFO: === returned 0 rows. - took 56 ms.
+INFO: +++ transaction committed.</pre></li></ul></div><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>You can click on "Create new artist" link to create artists. Existing artists
+ can be edited by clicking on their name:</p><p><span class="inlinemediaobject"><img src="images/firefox-webapp.png"></span></p></li></ul></div><p>You are done with the tutorial!</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="getting-started-part4.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="getting-started-part4.html">Up</a></td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left" valign="top">Part IV. Converting to Web Application </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>
\ No newline at end of file
Added: websites/staging/cayenne/trunk/content/v31/tutorial/index/getting-started-part1.html
==============================================================================
--- websites/staging/cayenne/trunk/content/v31/tutorial/index/getting-started-part1.html (added)
+++ websites/staging/cayenne/trunk/content/v31/tutorial/index/getting-started-part1.html Wed Nov 7 11:39:02 2012
@@ -0,0 +1,3 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Part I. Setting up the environment</title><link rel="stylesheet" type="text/css" href="css/cayenne-doc.css"><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"><link rel="home" href="index.html" title="Getting Started with Cayenne"><link rel="up" href="index.html" title="Getting Started with Cayenne"><link rel="prev" href="index.html" title="Getting Started with Cayenne"><link rel="next" href="ch01.html" title="Chapter 1. Setup"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Part I. Setting up the environment</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch01.html">Next</a></td></tr></table><hr></div><div class="part" title="P
art I. Setting up the environment"><div class="titlepage"><div><div><h1 class="title"><a name="getting-started-part1"></a>Part I. Setting up the environment</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="ch01.html">1. Setup</a></span></dt><dd><dl><dt><span class="section"><a href="ch01.html#install-java">Install Java</a></span></dt><dt><span class="section"><a href="ch01.html#install-eclipse-and-maven">Install Eclipse IDE and the Maven Plugin</a></span></dt></dl></dd></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch01.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Getting Started with Cayenne </td><td width="20%" align="center"><a accessk
ey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 1. Setup</td></tr></table></div></body></html>
\ No newline at end of file