You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by dk...@apache.org on 2011/09/26 17:43:09 UTC
svn commit: r1175913 [1/2] - in /cayenne/main/trunk/docs/docbook: ./
getting-started/ getting-started/src/ getting-started/src/docbkx/
getting-started/src/images/ getting-started/target/
getting-started/target/site/
Author: dkazimirchyk
Date: Mon Sep 26 15:43:08 2011
New Revision: 1175913
URL: http://svn.apache.org/viewvc?rev=1175913&view=rev
Log:
converted 'Getting Started Tutorial' to docbook
Added:
cayenne/main/trunk/docs/docbook/getting-started/
cayenne/main/trunk/docs/docbook/getting-started/pom.xml
cayenne/main/trunk/docs/docbook/getting-started/src/
cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/
cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/delete.xml
cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/index.xml
cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/java-classes.xml
cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/object-context.xml
cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/object-relational-mapping.xml
cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/part1.xml
cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/part2.xml
cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/part3.xml
cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/part4.xml
cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/persistent-objects.xml
cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/select-query.xml
cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/setup.xml
cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/starting-project.xml
cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/webapp.xml
cayenne/main/trunk/docs/docbook/getting-started/src/images/
cayenne/main/trunk/docs/docbook/getting-started/src/images/.gitignore
cayenne/main/trunk/docs/docbook/getting-started/src/images/base-datamap.png (with props)
cayenne/main/trunk/docs/docbook/getting-started/src/images/base-datanode.png (with props)
cayenne/main/trunk/docs/docbook/getting-started/src/images/database-schema.jpg (with props)
cayenne/main/trunk/docs/docbook/getting-started/src/images/eclipse-generatedclasses.png (with props)
cayenne/main/trunk/docs/docbook/getting-started/src/images/eclipse-mvnrun.png (with props)
cayenne/main/trunk/docs/docbook/getting-started/src/images/eclipse-xmlfiles.png (with props)
cayenne/main/trunk/docs/docbook/getting-started/src/images/firefox-webapp.png (with props)
cayenne/main/trunk/docs/docbook/getting-started/src/images/maven-plugin-install.png (with props)
cayenne/main/trunk/docs/docbook/getting-started/src/images/modeler-artistid.png (with props)
cayenne/main/trunk/docs/docbook/getting-started/src/images/modeler-dbrelationship.png (with props)
cayenne/main/trunk/docs/docbook/getting-started/src/images/modeler-started.png (with props)
cayenne/main/trunk/docs/docbook/getting-started/src/images/tutorial-eclipse-project.png (with props)
cayenne/main/trunk/docs/docbook/getting-started/target/
cayenne/main/trunk/docs/docbook/getting-started/target/site/
cayenne/main/trunk/docs/docbook/getting-started/target/site/index.fo
cayenne/main/trunk/docs/docbook/getting-started/target/site/index.pdf (with props)
Modified:
cayenne/main/trunk/docs/docbook/pom.xml
Added: cayenne/main/trunk/docs/docbook/getting-started/pom.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/pom.xml?rev=1175913&view=auto
==============================================================================
--- cayenne/main/trunk/docs/docbook/getting-started/pom.xml (added)
+++ cayenne/main/trunk/docs/docbook/getting-started/pom.xml Mon Sep 26 15:43:08 2011
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<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/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.cayenne.docs</groupId>
+ <artifactId>cayenne-docbook</artifactId>
+ <version>3.1M4-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.cayenne.docs</groupId>
+ <artifactId>getting-started</artifactId>
+ <name>Docbook: Getting Started with Cayenne</name>
+</project>
Added: cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/delete.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/delete.xml?rev=1175913&view=auto
==============================================================================
--- cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/delete.xml (added)
+++ cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/delete.xml Mon Sep 26 15:43:08 2011
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
+<chapter xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
+ <title>Deleting objects...</title>
+ <para>This section explains how to model relationship delete rules and how to delete individual
+ objects as well as sets of objects. Also demonstrated the use of Cayenne class to run a
+ query.</para>
+ <section xml:id="setup-delete-rules">
+ <title>Setting Up Delete Rules</title>
+ <para>Before we discuss the API for object deletion, lets go back to CayenneModeler and set
+ up some <link xlink:href="http://cayenne.apache.org/doc/delete-rules.html">delete
+ rules</link>. Doing this is optional but will simplify correct handling of the
+ objects related to deleted objects.</para>
+ <para>In the Modeler go to "Artist" ObjEntity, "Relationships" tab and select "Cascade" for
+ the "paintings" relationship delete rule:</para>
+ <para> Unable to render embedded object: File (modeler-deleterule.png) not found. </para>
+ <para>Repeat this step for other relationships:</para>
+ <itemizedlist>
+ <listitem>
+ <para>For Gallery set "paintings" relationship to be "Nullify", as a painting can
+ exist without being displayed in a gallery.</para>
+ </listitem>
+ <listitem>
+ <para>For Painting et both relationships rules to "Nullify".</para>
+ </listitem>
+ </itemizedlist>
+ <para>Now save the mapping, and refresh the project in Eclispe.</para>
+ </section>
+ <section xml:id="deleting-objects">
+ <title>Deleting Objects</title>
+ <para>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:</para>
+ <programlisting>Expression qualifier = ExpressionFactory.matchExp(Artist.NAME_PROPERTY, "Pablo Picasso");
+SelectQuery select = new SelectQuery(Artist.class, qualifier);
+Artist picasso = (Artist) Cayenne.objectForQuery(context, select);</programlisting>
+ <para>Now let's delete the artist:</para>
+ <programlisting>if (picasso != null) {
+ context.deleteObject(picasso);
+ context.commitChanges();
+}</programlisting>
+ <para>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:</para>
+ <programlisting>INFO: SELECT t0.DATE_OF_BIRTH, t0.ID, t0.NAME FROM ARTIST t0 WHERE t0.NAME = ?
+ [bind: 1->NAME:'Pablo Picasso']
+INFO: === returned 1 row. - took 5 ms.
+INFO: +++ transaction committed.
+INFO: --- will run 2 queries.
+INFO: --- transaction started.
+INFO: DELETE FROM PAINTING WHERE ID = ?
+INFO: [batch bind: 1->ID:2]
+INFO: [batch bind: 1->ID:1]
+INFO: === updated 2 rows.
+INFO: DELETE FROM ARTIST WHERE ID = ?
+INFO: [batch bind: 1->ID:1]
+INFO: === updated 1 row.
+INFO: +++ transaction committed.
+</programlisting>
+ </section>
+</chapter>
Added: cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/index.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/index.xml?rev=1175913&view=auto
==============================================================================
--- cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/index.xml (added)
+++ cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/index.xml Mon Sep 26 15:43:08 2011
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<book xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
+ xml:id="getting-started" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <info>
+ <title>Getting Started with Cayenne</title>
+ <copyright>
+ <year>2011</year>
+ <holder>Apache Software Foundation and individual authors</holder>
+ </copyright>
+ <authorgroup>
+ <author>
+ <personname>Aristedes Maniatis</personname>
+ </author>
+ <author>
+ <personname>Andrus Adamchik</personname>
+ </author>
+ </authorgroup>
+ <legalnotice>
+ <title>License</title>
+ <para>Licensed to the Apache Software Foundation (ASF) under one or more contributor
+ license agreements. See the NOTICE file distributed with this work for additional
+ information regarding copyright ownership. The ASF licenses this file to you under
+ the Apache License, Version 2.0 (the "License"); you may not use this file except in
+ compliance with the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0</para>
+
+ <para>Unless required by applicable law or agreed to in writing, software distributed
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
+ language governing permissions and limitations under the License.</para>
+ </legalnotice>
+ </info>
+ <xi:include href="part1.xml"/>
+ <xi:include href="part2.xml"/>
+ <xi:include href="part3.xml"/>
+ <xi:include href="part4.xml"/>
+</book>
Added: cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/java-classes.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/java-classes.xml?rev=1175913&view=auto
==============================================================================
--- cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/java-classes.xml (added)
+++ cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/java-classes.xml Mon Sep 26 15:43:08 2011
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
+<chapter xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
+ <title>Creating Java Classes...</title>
+ <para>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".
+ </para>
+ <section xml:id="creating-java-classes">
+ <title>Creating Java Classes</title>
+ <itemizedlist>
+ <listitem>
+ <para>Select "Tools > Generate Classes" menu.</para>
+ </listitem>
+ <listitem>
+ <para>For "Type" select "Standard Persistent Objects", if it is not already
+ selected.</para>
+ </listitem>
+ <listitem>
+ <para>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).</para>
+ </listitem>
+ <listitem>
+ <para>Click on "Entities" tab and check the "Check All Entities" checkbox (unless it
+ is already checked and reads "Uncheck all Entities").</para>
+ </listitem>
+ <listitem>
+ <para>Click "Generate"</para>
+ </listitem>
+ </itemizedlist>
+ <para>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:<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.1M1</version>
+ </dependency>
+ </dependencies>
+</project></programlisting></para>
+ <para>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.</para>
+ <para>Now let's check the entity class pairs. Each one is made of a superclass (e.g.
+ <emphasis role="italic">Artist) and a subclass (e.g. Artist). You <emphasis
+ role="bold">should not</emphasis> modify the superclasses whose names start with
+ "</emphasis>" (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.</para>
+ <para>
+ <informaltable>
+ <col width="3%"/>
+ <col width="97%"/>
+ <tr>
+ <td rowspan="1" colspan="1" valign="top">
+ <mediaobject>
+ <imageobject>
+ <imagedata
+ fileref="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif"
+ depth="16" width="16"/>
+ </imageobject>
+ </mediaobject>
+ </td>
+ <td rowspan="1" colspan="1"><emphasis role="bold">Class Generation
+ Hint</emphasis>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 <link xlink:href="http://cayenne.apache.org/doc/cgen.html">Ant
+ cgen task</link> or <link
+ xlink:href="http://cayenne.apache.org/doc/maven2-cgen.html">Maven cgen
+ mojo</link>. 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>
+ </informaltable>
+ </para>
+
+ </section>
+</chapter>
Added: cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/object-context.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/object-context.xml?rev=1175913&view=auto
==============================================================================
--- cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/object-context.xml (added)
+++ cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/object-context.xml Mon Sep 26 15:43:08 2011
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
+<chapter xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
+ <title>Getting started with ObjectContext...</title>
+ <para>In this section we'll write a simple main class to run our application, and get a brief
+ introduction to Cayenne ObjectContext.</para>
+ <section xml:id="creating-main-class">
+ <title>Creating the Main Class</title>
+ <itemizedlist>
+ <listitem>
+ <para>In Eclipse create a new class called "Main" in the "org.example.cayenne"
+ package.</para>
+ </listitem>
+ <listitem>
+ <para>Create a standard "main" method to make it a runnable
+ class:<programlisting>package org.example.cayenne;
+
+public class Main {
+
+ public static void main(String[] args) {
+
+ }
+}</programlisting></para>
+ </listitem>
+ <listitem>
+ <para>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.<programlisting>package org.example.cayenne;
+
+import org.apache.cayenne.ObjectContext;
+import org.apache.cayenne.access.DataContext;
+
+public class Main {
+
+ public static void main(String[] args) {
+ ServerRuntime cayenneRuntime = new ServerRuntime(
+ "cayenne-UntitledDomain.xml");
+ ObjectContext context = cayenneRuntime.getContext();
+ }
+}</programlisting></para>
+ <para>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.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </section>
+ <section xml:id="runnning-app">
+ <title>Running Application</title>
+ <para>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:<programlisting><dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.5.3.0_1</version>
+</dependency></programlisting>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:<programlisting>INFO: started configuration loading.
+INFO: loaded domain: UntitledDomain
+INFO: loaded <map name='UntitledDomainMap' location='UntitledDomainMap.map.xml'>.
+INFO: loading <node name='UntitledDomainNode' datasource='UntitledDomainNode.driver.xml'
+factory='org.apache.cayenne.conf.DriverDataSourceFactory'
+schema-update-strategy='org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy'>.
+INFO: using factory: org.apache.cayenne.conf.DriverDataSourceFactory
+INFO: loading driver information from 'UntitledDomainNode.driver.xml'.
+INFO: loading driver org.apache.derby.jdbc.EmbeddedDriver
+INFO: loading user name and password.
+INFO: Created connection pool: jdbc:derby:memory:testdb;create=true
+ Driver class: org.apache.derby.jdbc.EmbeddedDriver
+ Min. connections in the pool: 1
+ Max. connections in the pool: 1
+INFO: loaded datasource.
+INFO: no adapter set, using automatic adapter.
+INFO: loaded map-ref: UntitledDomainMap.
+INFO: finished configuration loading in 396 ms.</programlisting><informaltable>
+ <col width="5%"/>
+ <col width="95%"/>
+ <tr>
+ <td rowspan="1" colspan="1" valign="top">
+ <mediaobject>
+ <imageobject>
+ <imagedata
+ fileref="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif"
+ depth="16" width="16"/>
+ </imageobject>
+ </mediaobject>
+ </td>
+ <td rowspan="1" colspan="1"><emphasis role="bold">How to Configure Cayenne
+ Logging</emphasis>You can tweak more or less detailed output by
+ following the instructions in the <link
+ xlink:href="http://cayenne.apache.org/doc/configuring-logging.html"
+ >logging chapter</link>.</td>
+ </tr>
+ </informaltable>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.</para>
+ </section>
+</chapter>
Added: cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/object-relational-mapping.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/object-relational-mapping.xml?rev=1175913&view=auto
==============================================================================
--- cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/object-relational-mapping.xml (added)
+++ cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/object-relational-mapping.xml Mon Sep 26 15:43:08 2011
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
+<chapter xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
+ <title>Getting started with Object Relational Mapping (ORM)...</title>
+ <para> 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:</para>
+ <para><inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="../images/database-schema.jpg"/>
+ </imageobject>
+ </inlinemediaobject>
+ </para>
+ <para>
+ <informaltable>
+ <col width="3%"/>
+ <col width="97%"/>
+ <tr>
+ <td rowspan="1" colspan="1" valign="top">
+ <mediaobject>
+ <imageobject>
+ <imagedata
+ fileref="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif"
+ depth="16" width="16"/>
+ </imageobject>
+ </mediaobject>
+ </td>
+ <td rowspan="1" colspan="1">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>
+ </informaltable>
+ </para>
+ <section xml:id="mapping-db-tables-and-columns">
+ <title>Mapping Database Tables and Columns</title>
+ <para>Lets go back to CayenneModeler where we have the newly created project open and start
+ by adding the ARTIST table. Database tables are called <emphasis role="bold"
+ >"DbEntities"</emphasis> in Cayenne mapping (those can be actual tables or database
+ views). </para>
+ <para>Select "UntitledDomainMap" 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:</para>
+ <para><inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="../images/modeler-artistid.png" scalefit="1"/>
+ </imageobject>
+ </inlinemediaobject></para>
+ <para>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.</para>
+ <para>
+ <informaltable>
+ <col width="4%"/>
+ <col width="96%"/>
+ <tr>
+ <td rowspan="1" colspan="1" valign="top">
+ <mediaobject>
+ <imageobject>
+ <imagedata
+ fileref="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif"
+ depth="16" width="16"/>
+ </imageobject>
+ </mediaobject>
+ </td>
+ <td rowspan="1" colspan="1">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>
+ </informaltable>
+ </para>
+ </section>
+ <section xml:id="mapping-db-relationships">
+ <title>Mapping Database Relationships</title>
+ <para>Now we need to specify relationships between ARTIST, PAINTING and GALLERY tables.
+ Start by creating a one-to-many ARTIST/PAINTING relationship:</para>
+ <itemizedlist>
+ <listitem>
+ <para>Select the ARTIST DbEntity on the left and click on the "Relationships"
+ tab.</para>
+ </listitem>
+ <listitem>
+ <para>Click on "Create Relationship" button on the entity toolbar (second button
+ from the left) - a relationship called "untitledRel" is created.</para>
+ </listitem>
+ <listitem>
+ <para>Choose the "Target" to be "Painting".</para>
+ </listitem>
+ <listitem>
+ <para>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".</para>
+ </listitem>
+ <listitem>
+ <para>Click on "Add" button on the right to add a join</para>
+ </listitem>
+ <listitem>
+ <para>Select "ID" column for the "Source" and "ARTIST_ID" column for the
+ target.</para>
+ </listitem>
+ <listitem>
+ <para>Relationship information should now look like this:</para>
+ </listitem>
+ </itemizedlist>
+ <para><inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="../images/modeler-dbrelationship.png"/>
+ </imageobject>
+ </inlinemediaobject></para>
+ <itemizedlist>
+ <listitem>
+ <para>Click "Done" to confirm the changes and close the dialog.</para>
+ </listitem>
+ <listitem>
+ <para>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.</para>
+ </listitem>
+ <listitem>
+ <para>Repeat the steps above to create a many-to-one relationship from PAINTING to
+ GALLERY, calling the relationships pair "gallery" and "paintings".</para>
+ </listitem>
+ </itemizedlist>
+ </section>
+ <section xml:id="mapping-java-classes">
+ <title>Mapping Java Classes</title>
+ <para>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.</para>
+ <itemizedlist>
+ <listitem>
+ <para>Select "ARTIST" DbEntity and click on "Create ObjEntity" button (a green class
+ icon) either on the entity toolbar or on the main toolbar. An ObjEntity called
+ "Artist" is created with a Java class field set to "cayenne.tutorial.Artist".
+ The modeler transformed the database names to the Java-friendly names (e.g., if
+ you click on the "Attributes" tab, you'll see that "DATE_OF_BIRTH" column was
+ converted to "dateOfBirth" Java class attribute).</para>
+ </listitem>
+ <listitem>
+ <para>Select "GALLERY" DbEntity and click on "Create ObjEntity" button again -
+ you'll see a "Gallery" ObjEntity created.</para>
+ </listitem>
+ <listitem>
+ <para>Finally, do the same thing for "PAINTING".</para>
+ </listitem>
+ </itemizedlist>
+ <para>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. <itemizedlist>
+ <listitem>
+ <para>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.</para>
+ </listitem>
+ <listitem>
+ <para>Do the same for the "Gallery" entity.</para>
+ </listitem>
+ </itemizedlist></para>
+ <para>Unless you want to customize the Java class and property names (which you can do
+ easily) the mapping is complete. </para>
+ </section>
+</chapter>
Added: cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/part1.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/part1.xml?rev=1175913&view=auto
==============================================================================
--- cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/part1.xml (added)
+++ cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/part1.xml Mon Sep 26 15:43:08 2011
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<part xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
+ xml:id="getting-started-part1" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Setting up the environment...</title>
+ <xi:include href="setup.xml"/>
+</part>
Added: cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/part2.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/part2.xml?rev=1175913&view=auto
==============================================================================
--- cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/part2.xml (added)
+++ cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/part2.xml Mon Sep 26 15:43:08 2011
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
+<part xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
+ xml:id="getting-started-part2" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Learning mapping basics</title>
+ <xi:include href="starting-project.xml"/>
+ <xi:include href="object-relational-mapping.xml"/>
+ <xi:include href="java-classes.xml"/>
+</part>
Added: cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/part3.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/part3.xml?rev=1175913&view=auto
==============================================================================
--- cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/part3.xml (added)
+++ cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/part3.xml Mon Sep 26 15:43:08 2011
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
+<part xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
+ xml:id="getting-started-part3" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Learning Cayenne API</title>
+ <xi:include href="object-context.xml"/>
+ <xi:include href="persistent-objects.xml"/>
+ <xi:include href="select-query.xml"/>
+ <xi:include href="delete.xml"/>
+</part>
Added: cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/part4.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/part4.xml?rev=1175913&view=auto
==============================================================================
--- cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/part4.xml (added)
+++ cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/part4.xml Mon Sep 26 15:43:08 2011
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<part xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
+ xml:id="getting-started-part4" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Converting to web application...</title>
+ <xi:include href="webapp.xml"/>
+</part>
+
Added: cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/persistent-objects.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/persistent-objects.xml?rev=1175913&view=auto
==============================================================================
--- cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/persistent-objects.xml (added)
+++ cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/persistent-objects.xml Mon Sep 26 15:43:08 2011
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
+<chapter xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
+ <title>Getting started with persistent objects...</title>
+ <para>In this section we'll learn about persistent objects, how to customize them and how to
+ create and save them in DB.</para>
+ <section xml:id="customizing-persistent-objects">
+ <title>Inspecting and Customizing Persistent Objects</title>
+ <para>Persistent classes in Cayenne implement a <link
+ xlink:href="http://cayenne.apache.org/doc/dataobjects.html">DataObject
+ interface</link>. If you inspect any of the classes <link
+ xlink:href="http://cayenne.apache.org/doc/tutorial-java-classes.html">generated
+ earlier</link> 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.</para>
+ <para>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:</para>
+ <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);
+ }
+ }
+}</programlisting>
+ </section>
+ <section xml:id="create-new-objects">
+ <title>Create New Objects</title>
+ <para>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 <emphasis
+ role="bold">must</emphasis> 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:</para>
+ <programlisting>Artist picasso = context.newObject(Artist.class);
+picasso.setName("Pablo Picasso");
+picasso.setDateOfBirthString("18811025");</programlisting>
+ <para>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":</para>
+ <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");</programlisting>
+ <para>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)).</para>
+ <programlisting>picasso.addToPaintings(girl);
+picasso.addToPaintings(stein);
+
+girl.setGallery(metropolitan);
+stein.setGallery(metropolitan);</programlisting>
+ <para>Now lets save all five new objects, in a single method call:</para>
+ <programlisting>context.commitChanges();</programlisting>
+ <para>Now you can run the application again as described <link
+ xlink:href="http://cayenne.apache.org/doc/tutorial-objectcontext.html">in the
+ previous section</link>. The new output will show a few actual DB operations:</para>
+ <programlisting>Dec 20, 2009 11:11:37 PM org.apache.cayenne.conf.RuntimeLoadDelegate startedLoading
+INFO: started configuration loading.
+...
+INFO: Opening connection: jdbc:derby:memory:testdb;create=true
+ Login: null
+ Password: *******
+INFO: +++ Connecting: SUCCESS.
+INFO: --- transaction started.
+INFO: Detected and installed adapter: org.apache.cayenne.dba.derby.DerbyAdapter
+INFO: --- will run 3 queries.
+INFO: No schema detected, will create mapped tables
+INFO: CREATE TABLE ARTIST (DATE_OF_BIRTH DATE, ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+ NAME VARCHAR (200), PRIMARY KEY (ID))
+INFO: CREATE TABLE GALLERY (ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY, NAME VARCHAR (200),
+ PRIMARY KEY (ID))
+INFO: CREATE TABLE PAINTING (ARTIST_ID INTEGER, GALLERY_ID INTEGER, ID INTEGER NOT NULL
+ GENERATED BY DEFAULT AS IDENTITY, NAME VARCHAR (200), PRIMARY KEY (ID))
+INFO: ALTER TABLE PAINTING ADD FOREIGN KEY (ARTIST_ID) REFERENCES ARTIST (ID)
+INFO: ALTER TABLE PAINTING ADD FOREIGN KEY (GALLERY_ID) REFERENCES GALLERY (ID)
+INFO: CREATE TABLE AUTO_PK_SUPPORT ( TABLE_NAME CHAR(100) NOT NULL, NEXT_ID BIGINT NOT NULL,
+PRIMARY KEY(TABLE_NAME))
+INFO: DELETE FROM AUTO_PK_SUPPORT WHERE TABLE_NAME IN ('ARTIST', 'GALLERY', 'PAINTING')
+INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('ARTIST', 200)
+INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('GALLERY', 200)
+INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('PAINTING', 200)
+INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'ARTIST']
+INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'GALLERY']
+INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'PAINTING']
+INFO: --- will run 3 queries.
+INFO: INSERT INTO ARTIST (DATE_OF_BIRTH, ID, NAME) VALUES (?, ?, ?)
+INFO: [batch bind: 1->DATE_OF_BIRTH:'1881-10-25 00:00:00.0', 2->ID:200,
+3->NAME:'Pablo Picasso']
+INFO: === updated 1 row.
+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 PAINTING (ARTIST_ID, GALLERY_ID, ID, NAME) VALUES (?, ?, ?, ?)
+INFO: [batch bind: 1->ARTIST_ID:200, 2->GALLERY_ID:200, 3->ID:200,
+4->NAME:'Girl Reading at a Table']
+INFO: [batch bind: 1->ARTIST_ID:200, 2->GALLERY_ID:200, 3->ID:201,
+4->NAME:'Gertrude Stein']
+INFO: === updated 2 rows.
+INFO: +++ transaction committed.
+</programlisting>
+ <para>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.</para>
+ </section>
+</chapter>
Added: cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/select-query.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/select-query.xml?rev=1175913&view=auto
==============================================================================
--- cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/select-query.xml (added)
+++ cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/select-query.xml Mon Sep 26 15:43:08 2011
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
+<chapter xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
+ <title>Selecting objects...</title>
+ <para>This section shows how to select objects from the database using SelectQuery. </para>
+ <section xml:id="introducing-select-query">
+ <title>Introducing SelectQuery</title>
+ <para>It was shown before how to <link
+ xlink:href="http://cayenne.apache.org/doc/tutorial-persistent-objects.html">persist
+ new objects</link>. Cayenne <link
+ xlink:href="http://cayenne.apache.org/doc/queries.html">queries</link> are used to
+ access already saved objects. The primary query type used for selecting objects is <link
+ xlink:href="http://cayenne.apache.org/doc/selectquery.html">SelectQuery</link>. 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.</para>
+ <itemizedlist>
+ <listitem>
+ <para>Select all paintings (the code, and the log output it generates):</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>SelectQuery select1 = new SelectQuery(Painting.class);
+List paintings1 = context.performQuery(select1);</programlisting>
+ <programlisting>INFO: SELECT t0.GALLERY_ID, t0.ARTIST_ID, t0.NAME, t0.ID FROM PAINTING t0
+INFO: === returned 2 rows. - took 18 ms.</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Select paintings that start with "gi", ignoring case (read more about
+ qualifier Expressions and ExpressionFactory <link
+ xlink:href="http://cayenne.apache.org/doc/expressions.html"
+ >here</link>:</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>Expression qualifier2 = ExpressionFactory.likeIgnoreCaseExp(
+ Painting.NAME_PROPERTY,
+ "gi%");
+SelectQuery select2 = new SelectQuery(Painting.class, qualifier2);
+List paintings2 = context.performQuery(select2);</programlisting>
+ <programlisting>INFO: SELECT t0.GALLERY_ID, t0.ARTIST_ID, t0.NAME, t0.ID FROM PAINTING t0
+WHERE UPPER(t0.NAME) LIKE UPPER(?) [bind: 1->NAME:'gi%']
+INFO: === returned 1 row. - took 12 ms.</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Select all paintings done by artists who were born more than a 100 years ago
+ (demonstrating using Expression.fromString(..) instead of
+ ExpressionFactory):</para>
+ </listitem>
+ </itemizedlist>
+ <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);</programlisting>
+ <programlisting>SELECT t0.GALLERY_ID, t0.ARTIST_ID, t0.NAME, t0.ID FROM PAINTING t0
+JOIN ARTIST t1 ON (t0.ARTIST_ID = t1.ID) WHERE t1.DATE_OF_BIRTH < ?
+[bind: 1->DATE_OF_BIRTH:'1909-01-01 00:00:00.378']
+INFO: === returned 2 rows. - took 19 ms.</programlisting>
+ </section>
+</chapter>
Added: cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/setup.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/setup.xml?rev=1175913&view=auto
==============================================================================
--- cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/setup.xml (added)
+++ cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/setup.xml Mon Sep 26 15:43:08 2011
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
+<chapter xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
+ <title>Setup</title>
+ <para> 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. </para>
+ <section xml:id="install-java">
+ <title>Install Java</title>
+ <para>
+ Obviously, JDK has to be installed. Cayenne 3.1 requires JDK 1.5 or newer.
+ </para>
+ </section>
+ <section xml:id="install-eclipse-and-maven">
+ <title>Install Eclipse IDE and the Maven Plugin</title>
+ <para> Download Eclipse <link xlink:href="http://www.eclipse.org/downloads/">from
+ here</link>. This tutorial is based on the Galileo package (Eclipse 3.5), JEE
+ edition, still it should work with any recent vanilla Eclipse distribution. </para>
+ <para> After downloading Eclipse, unpack it somewhere in the filesystem, and start it. The
+ only plugin that you need for the tutorial is <link
+ xlink:href="http://m2eclipse.sonatype.org/">m2eclipse</link>. 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
+ "http://m2eclipse.sonatype.org/sites/m2e" in the "Location" field. You may install any
+ of the optional components that you think you need, but for this tutorial we only select
+ a few basic components as shown on the following screenshot: </para>
+ <para>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="../images/maven-plugin-install.png" scalefit="1"/>
+ </imageobject>
+ </inlinemediaobject></para>
+ <para>
+ From here follow the Eclipse dialog instructions to finish the installation.
+ </para>
+ </section>
+</chapter>
Added: cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/starting-project.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/starting-project.xml?rev=1175913&view=auto
==============================================================================
--- cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/starting-project.xml (added)
+++ cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/starting-project.xml Mon Sep 26 15:43:08 2011
@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
+<chapter xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
+ <title>Starting a project...</title>
+ <para>
+ 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.
+ </para>
+ <section xml:id="create-new-project">
+ <title>Create a new Project in Eclipse </title>
+ <para>
+ 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".
+ </para>
+ <para>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="../images/tutorial-eclipse-project.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ </para>
+ <para>
+ 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).
+ </para>
+ </section>
+ <section xml:id="download-and-start-cayenne-modeler">
+ <title>Download and Start CayenneModeler</title>
+ <para>
+ 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.
+ </para>
+ <para>
+ <informaltable>
+ <tr>
+ <td rowspan="1" colspan="1" valign="top">
+ <mediaobject>
+ <imageobject>
+ <imagedata
+ fileref="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif"
+ depth="16" width="16"/>
+ </imageobject>
+ </mediaobject>
+ </td>
+ <td rowspan="1" colspan="1">If you are really into Maven, you can <link
+ xlink:href="http://cayenne.apache.org/doc/maven2-modeler.html">start
+ CayenneModeler from Maven</link> if you wish. We'll do it in a more
+ traditional way here.</td>
+ </tr>
+ </informaltable>
+ </para>
+ <para>
+ Download the latest release <link xlink:href="http://cayenne.apache.org/download.html"
+ >from here</link>. Unpack the distribution somewhere in the file system and start
+ CayenneModeler, following <link
+ xlink:href="http://cayenne.apache.org/doc/running-cayennemodeler.html"
+ >platform-specific instructions</link>. On most platforms it is done simply by
+ doubleclicking the Modeler icon. The welcome screen of the Modeler looks like
+ this:
+ </para>
+ <para><inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="../images/modeler-started.png" scalefit="1"/>
+ </imageobject>
+ </inlinemediaobject></para>
+ </section>
+ <section xml:id="create-new-mapping-project">
+ <title>Create a New Mapping Project in CayenneModeler</title>
+ <para>Click on the "New Project" button on Welcome screen. A new mapping project will appear
+ that contains a single <emphasis role="bold">DataDomain</emphasis>. 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.</para>
+
+ </section>
+ <section xml:id="create-datanode">
+ <title>Create a DataNode</title>
+ <para>The next project object you will create is a <emphasis role="bold"
+ >DataNode</emphasis>. 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 "UntitledDomain" selected on the left, click on "Create
+ DataNode" button on the toolbar (or select "Project > Create DataNode" from the
+ menu.</para>
+ <para>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: <itemizedlist>
+ <listitem>
+ <para>JDBC Driver: org.apache.derby.jdbc.EmbeddedDriver</para>
+ </listitem>
+ <listitem>
+ <para>DB URL: jdbc:derby:memory:testdb;create=true</para>
+ </listitem>
+ </itemizedlist></para>
+ <para>
+ <informaltable>
+ <tr>
+ <td rowspan="1" colspan="1" valign="top">
+ <mediaobject>
+ <imageobject>
+ <imagedata
+ fileref="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif"
+ depth="16" width="16"/>
+ </imageobject>
+ </mediaobject>
+ </td>
+ <td rowspan="1" colspan="1">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>
+ </informaltable>
+ </para>
+ <para>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.</para>
+ <para><inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="../images/base-datanode.png" scalefit="1"/>
+ </imageobject>
+ </inlinemediaobject></para>
+
+ </section>
+ <section xml:id="create-datamap">
+ <title>Create a DataMap</title>
+ <para>Now you will create a <emphasis role="bold">DataMap</emphasis>. 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.</para>
+ <para>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.</para>
+ <para><inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="../images/base-datamap.png" scalefit="1"/>
+ </imageobject>
+ </inlinemediaobject></para>
+
+ </section>
+ <section xml:id="save-project">
+ <title>Save the Project</title>
+ <para>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.</para>
+ <para><inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="../images/eclipse-xmlfiles.png"/>
+ </imageobject>
+ </inlinemediaobject></para>
+ <para>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).</para>
+ </section>
+</chapter>
Added: cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/webapp.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/webapp.xml?rev=1175913&view=auto
==============================================================================
--- cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/webapp.xml (added)
+++ cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/webapp.xml Mon Sep 26 15:43:08 2011
@@ -0,0 +1,301 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
+<chapter xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
+ <title>Converting to web application...</title>
+ <para>This sections shows how to work with Cayenne in a web application.</para>
+ <section xml:id="converting-to-webapp">
+ <title>Converting Tutorial to a Web Application</title>
+ <para>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:</para>
+ <itemizedlist>
+ <listitem>
+ <para>Cayenne configuiration is loaded when an application context is started, using
+ a special servlet filter.</para>
+ </listitem>
+ <listitem>
+ <para>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.</para>
+ </listitem>
+ <listitem>
+ <para>The same DataContext instance is reused within a single user session;
+ different sessions use different DataContexts (and therefore different sets of
+ objects). <emphasis role="italic">However see "ObjectContext Scope" section of
+ the <link xlink:href="http://cayenne.apache.org/doc/web-applications.html"
+ >Web Applications</link> page. The context can be scoped differently
+ depending on the app specifics. For the tutorial we'll be using a
+ session-scoped context.</emphasis></para>
+ </listitem>
+ </itemizedlist>
+ <para>For more information on the web application deployment, check <link
+ xlink:href="http://cayenne.apache.org/doc/web-applications.html">Web
+ Applications</link> page.</para>
+ <para>So let's convert the tutorial that we created to a web application:</para>
+ <itemizedlist>
+ <listitem>
+ <para>In Eclipse under "tutorial" project folder create a new folder
+ "src/main/webapp/WEB-INF".</para>
+ </listitem>
+ <listitem>
+ <para>Under "WEB-INF" create a new file "web.xml" (a standard web app descriptor): </para>
+ <para>
+ <emphasis role="bold">web.xml</emphasis>
+ <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-UntitledDomain</filter-name>
+ <filter-class>org.apache.cayenne.configuration.web.CayenneFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>cayenne-UntitledDomain</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+ <welcome-file-list>
+ <welcome-file>index.jsp</welcome-file>
+ </welcome-file-list>
+</web-app></programlisting></para>
+ </listitem>
+ <listitem>
+ <para>Create the artist browser page src/main/webapp/index.jsp file with the
+ following contents: </para>
+ <para><emphasis role="bold">webapp/index.jsp</emphasis>
+ <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> </programlisting></para>
+ </listitem>
+ <listitem>
+ <para>Create the artist editor page src/main/webapp/detail.jsp with the following
+ content: </para>
+ <para><emphasis role="bold">webapp/detail.jsp</emphasis>
+ <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></programlisting></para>
+ </listitem>
+ </itemizedlist>
+ </section>
+ <section xml:id="running-webapp">
+ <title>Running Web Application</title>
+ <para>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:</para>
+ <programlisting><build>
+ <plugins>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.22</version>
+ </plugin>
+ </plugins>
+</build></programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Go to "Run > Run Configurations..." menu, select "Maven Build", right click
+ and select "New"</para>
+ </listitem>
+ <listitem>
+ <para>Make sure you fill "Name", "Base directory" and "Goals" fields as shown on the
+ screenshot:</para>
+ <para><inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="../images/eclipse-mvnrun.png" scalefit="1"/>
+ </imageobject>
+ </inlinemediaobject></para>
+ </listitem>
+ </itemizedlist>
+ <itemizedlist>
+ <listitem>
+ <para>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:</para>
+ <programlisting>[INFO] Scanning for projects...
+[INFO] ------------------------------------------------------------------------
+[INFO] Building Unnamed - org.example.cayenne:tutorial:jar:0.0.1-SNAPSHOT
+[INFO]
+[INFO] Id: org.example.cayenne:tutorial:jar:0.0.1-SNAPSHOT
+[INFO] task-segment: [jetty:run]
+[INFO] ------------------------------------------------------------------------
+...
+[INFO] [jetty:run]
+[INFO] Configuring Jetty for project: Unnamed - org.example.cayenne:tutorial:jar:0.0.1-SNAPSHOT
+[INFO] Webapp source directory = /.../tutorial/Desktop/work/tutorial/src/main/webapp
+...
+[INFO] Starting jetty 6.1.22 ...
+2009-12-22 14:08:06.301::INFO: jetty-6.1.22
+2009-12-22 14:08:06.474::INFO: No Transaction manager found - if your webapp requires one, please configure one.
+INFO: started configuration loading.
+INFO: loaded domain: UntitledDomain
+INFO: loaded <map name='UntitledDomainMap' location='UntitledDomainMap.map.xml'>.
+INFO: loading <node name='UntitledDomainNode' datasource='UntitledDomainNode.driver.xml'
+factory='org.apache.cayenne.conf.DriverDataSourceFactory' schema-update-
+strategy='org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy'>.
+INFO: using factory: org.apache.cayenne.conf.DriverDataSourceFactory
+INFO: loading driver information from 'UntitledDomainNode.driver.xml'.
+INFO: loading driver org.apache.derby.jdbc.EmbeddedDriver
+INFO: loading user name and password.
+INFO: Created connection pool: jdbc:derby:memory:testdb;create=true
+ Driver class: org.apache.derby.jdbc.EmbeddedDriver
+ Min. connections in the pool: 1
+ Max. connections in the pool: 1
+INFO: loaded datasource.
+INFO: no adapter set, using automatic adapter.
+INFO: loaded map-ref: UntitledDomainMap.
+INFO: finished configuration loading in 355 ms.
+2009-12-22 14:08:07.081::INFO: Started SelectChannelConnector@0.0.0.0:8080
+[INFO] Started Jetty Server</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>So the Jetty container just started and loaded Cayenne.</para>
+ </listitem>
+ <listitem>
+ <para>Now go to <link xlink:href="http://localhost:8080/tutorial/"
+ >http://localhost:8080/tutorial/</link> URL. You should see "No artists
+ found message" in the web browser and the following output in the Eclipse
+ console:</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>INFO: --- will run 1 query.
+INFO: Opening connection: jdbc:derby:memory:testdb;create=true
+ Login: null
+ Password: *******
+INFO: +++ Connecting: SUCCESS.
+INFO: --- transaction started.
+INFO: Detected and installed adapter: org.apache.cayenne.dba.derby.DerbyAdapter
+INFO: No schema detected, will create mapped tables
+INFO: CREATE TABLE GALLERY (ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+NAME VARCHAR (200), PRIMARY KEY (ID))
+INFO: CREATE TABLE ARTIST (DATE_OF_BIRTH DATE, ID INTEGER NOT NULL GENERATED
+BY DEFAULT AS IDENTITY, NAME VARCHAR (200), PRIMARY KEY (ID))
+INFO: CREATE TABLE PAINTING (ARTIST_ID INTEGER, GALLERY_ID INTEGER,
+ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY, NAME VARCHAR (200), PRIMARY KEY (ID))
+INFO: ALTER TABLE PAINTING ADD FOREIGN KEY (ARTIST_ID) REFERENCES ARTIST (ID)
+INFO: ALTER TABLE PAINTING ADD FOREIGN KEY (GALLERY_ID) REFERENCES GALLERY (ID)
+INFO: CREATE TABLE AUTO_PK_SUPPORT ( TABLE_NAME CHAR(100) NOT NULL, NEXT_ID BIGINT NOT NULL, PRIMARY KEY(TABLE_NAME))
+INFO: DELETE FROM AUTO_PK_SUPPORT WHERE TABLE_NAME IN ('ARTIST', 'GALLERY', 'PAINTING')
+INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('ARTIST', 200)
+INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('GALLERY', 200)
+INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('PAINTING', 200)
+INFO: SELECT t0.DATE_OF_BIRTH, t0.ID, t0.NAME FROM ARTIST t0 ORDER BY t0.NAME - prepared in 35 ms.
+INFO: === returned 0 rows. - took 53 ms.
+INFO: +++ transaction committed.</programlisting>
+ </listitem>
+ </itemizedlist>
+ <itemizedlist>
+ <listitem>
+ <para>You can click on "Create new artist" link to create artists. Existing artists
+ can be edited by clicking on their name:</para>
+ <para><inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="../images/firefox-webapp.png" scalefit="1"/>
+ </imageobject>
+ </inlinemediaobject></para>
+ </listitem>
+ </itemizedlist>
+ <para>You are done with the tutorial!</para>
+ </section>
+</chapter>
Added: cayenne/main/trunk/docs/docbook/getting-started/src/images/.gitignore
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/images/.gitignore?rev=1175913&view=auto
==============================================================================
(empty)
Added: cayenne/main/trunk/docs/docbook/getting-started/src/images/base-datamap.png
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/images/base-datamap.png?rev=1175913&view=auto
==============================================================================
Binary file - no diff available.
Propchange: cayenne/main/trunk/docs/docbook/getting-started/src/images/base-datamap.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: cayenne/main/trunk/docs/docbook/getting-started/src/images/base-datanode.png
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/images/base-datanode.png?rev=1175913&view=auto
==============================================================================
Binary file - no diff available.
Propchange: cayenne/main/trunk/docs/docbook/getting-started/src/images/base-datanode.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: cayenne/main/trunk/docs/docbook/getting-started/src/images/database-schema.jpg
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/images/database-schema.jpg?rev=1175913&view=auto
==============================================================================
Binary file - no diff available.
Propchange: cayenne/main/trunk/docs/docbook/getting-started/src/images/database-schema.jpg
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: cayenne/main/trunk/docs/docbook/getting-started/src/images/eclipse-generatedclasses.png
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/images/eclipse-generatedclasses.png?rev=1175913&view=auto
==============================================================================
Binary file - no diff available.
Propchange: cayenne/main/trunk/docs/docbook/getting-started/src/images/eclipse-generatedclasses.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: cayenne/main/trunk/docs/docbook/getting-started/src/images/eclipse-mvnrun.png
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/images/eclipse-mvnrun.png?rev=1175913&view=auto
==============================================================================
Binary file - no diff available.
Propchange: cayenne/main/trunk/docs/docbook/getting-started/src/images/eclipse-mvnrun.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: cayenne/main/trunk/docs/docbook/getting-started/src/images/eclipse-xmlfiles.png
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/images/eclipse-xmlfiles.png?rev=1175913&view=auto
==============================================================================
Binary file - no diff available.
Propchange: cayenne/main/trunk/docs/docbook/getting-started/src/images/eclipse-xmlfiles.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: cayenne/main/trunk/docs/docbook/getting-started/src/images/firefox-webapp.png
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/images/firefox-webapp.png?rev=1175913&view=auto
==============================================================================
Binary file - no diff available.
Propchange: cayenne/main/trunk/docs/docbook/getting-started/src/images/firefox-webapp.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: cayenne/main/trunk/docs/docbook/getting-started/src/images/maven-plugin-install.png
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/images/maven-plugin-install.png?rev=1175913&view=auto
==============================================================================
Binary file - no diff available.
Propchange: cayenne/main/trunk/docs/docbook/getting-started/src/images/maven-plugin-install.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: cayenne/main/trunk/docs/docbook/getting-started/src/images/modeler-artistid.png
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/images/modeler-artistid.png?rev=1175913&view=auto
==============================================================================
Binary file - no diff available.
Propchange: cayenne/main/trunk/docs/docbook/getting-started/src/images/modeler-artistid.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: cayenne/main/trunk/docs/docbook/getting-started/src/images/modeler-dbrelationship.png
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/images/modeler-dbrelationship.png?rev=1175913&view=auto
==============================================================================
Binary file - no diff available.
Propchange: cayenne/main/trunk/docs/docbook/getting-started/src/images/modeler-dbrelationship.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: cayenne/main/trunk/docs/docbook/getting-started/src/images/modeler-started.png
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/images/modeler-started.png?rev=1175913&view=auto
==============================================================================
Binary file - no diff available.
Propchange: cayenne/main/trunk/docs/docbook/getting-started/src/images/modeler-started.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: cayenne/main/trunk/docs/docbook/getting-started/src/images/tutorial-eclipse-project.png
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/getting-started/src/images/tutorial-eclipse-project.png?rev=1175913&view=auto
==============================================================================
Binary file - no diff available.
Propchange: cayenne/main/trunk/docs/docbook/getting-started/src/images/tutorial-eclipse-project.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream