You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2012/12/26 20:20:16 UTC
svn commit: r1425994 [4/5] - in /cayenne/site/cms/trunk/content/docs/3.1:
cayenne-guide/ cayenne-guide/css/ tutorial/ tutorial/css/
Modified: cayenne/site/cms/trunk/content/docs/3.1/cayenne-guide/persistent-objects-objectcontext.html
URL: http://svn.apache.org/viewvc/cayenne/site/cms/trunk/content/docs/3.1/cayenne-guide/persistent-objects-objectcontext.html?rev=1425994&r1=1425993&r2=1425994&view=diff
==============================================================================
--- cayenne/site/cms/trunk/content/docs/3.1/cayenne-guide/persistent-objects-objectcontext.html (original)
+++ cayenne/site/cms/trunk/content/docs/3.1/cayenne-guide/persistent-objects-objectcontext.html Wed Dec 26 19:20:15 2012
@@ -1,211 +1,211 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Chapter 6. Persistent Objects and 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="Cayenne Guide"><link rel="up" href="cayenne-guide-part2.html" title="Part II. Cayenne Framework"><link rel="prev" href="starting-cayenne.html" title="Chapter 5. Starting Cayenne"><link rel="next" href="expressions.html" title="Chapter 7. Expressions"></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. Persistent Objects and ObjectContext</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="starting-cayenne.html">Prev</a> </td><th width="60%" align="center">Part II. Cayenne Framework</th><td width="20%" align="ri
ght"> <a accesskey="n" href="expressions.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 6. Persistent Objects and ObjectContext"><div class="titlepage"><div><div><h2 class="title"><a name="persistent-objects-objectcontext"></a>Chapter 6. Persistent Objects and ObjectContext</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="persistent-objects-objectcontext.html#objectcontext">ObjectContext</a></span></dt><dt><span class="section"><a href="persistent-objects-objectcontext.html#persistent-lifecycle">Persistent Object and its Lifecycle</a></span></dt><dt><span class="section"><a href="persistent-objects-objectcontext.html#persistent-operations">ObjectContext Persistence API</a></span></dt><dt><span class="section"><a href="persistent-objects-objectcontext.html#cayenne-helper-class">Cayenne Helper Class</a></span></dt><dt><span class="section"><a href="persistent-obj
ects-objectcontext.html#objectcontext-nesting">ObjectContext Nesting</a></span></dt><dt><span class="section"><a href="persistent-objects-objectcontext.html#generic-persistent-objects">Generic Persistent Objects</a></span></dt><dt><span class="section"><a href="persistent-objects-objectcontext.html#transactions">Transactions</a></span></dt></dl></div><div class="section" title="ObjectContext"><div class="titlepage"><div><div><h2 class="title"><a name="objectcontext"></a>ObjectContext</h2></div></div></div><p>ObjectContext is an interface that users normally work with to access the database. It
- provides the API to execute database operations and to manage persistent objects. A
- context is obtained from the
- ServerRuntime:</p><pre class="programlisting">ObjectContext context = runtime.getContext();</pre><p>The call above creates a new instance of ObjectContext that can access the database via this
- runtime. ObjectContext is a single "work area" in Cayenne, storing persistent objects.
- ObjectContext guarantees that for each database row with a unique ID it will contain at
- most one instance of an object, thus ensuring object graph consistency between multiple
- selects (a feature called "uniquing"). At the same time different ObjectContexts will
- have independent copies of objects for each unique database row. This allows users to
- isolate object changes from one another by using separate ObjectContexts.</p><p>These properties directly affect the strategies for scoping and sharing (or not
- sharing) ObjectContexts. Contexts that are only used to fetch objects from the database
- and whose objects are never modified by the application can be shared between mutliple
- users (and multiple threads). Contexts that store modified objects should be accessed
- only by a single user (e.g. a web application user might reuse a context instance
- between multiple web requests in the same HttpSession, thus carrying uncommitted changes
- to objects from request to request, until he decides to commit or rollback them). Even
- for a single user it might make sense to use mutliple ObjectContexts (e.g.
- request-scoped contexts to allow concurrent requests from the browser that change and
- commit objects independently).</p><p>ObjectContext is serializable and does not permanently hold to any of the application
- resources. So it does not have to be closed. If the context is not used anymore, it
- should simply be allowed to go out of scope and get garbage collected, just like any
- other Java object.</p></div><div class="section" title="Persistent Object and its Lifecycle"><div class="titlepage"><div><div><h2 class="title"><a name="persistent-lifecycle"></a>Persistent Object and its Lifecycle</h2></div></div></div><p>Cayenne can persist Java objects that implement <code class="code">org.apache.cayenne.Persistent</code>
- interface. Generally persistent classes are generated from the model as described above,
- so users do not have to worry about superclass and property implementation details. </p><p>Persistent interface provides access to 3 persistence-related properties - objectId,
- persistenceState and objectContext. All 3 are initialized by Cayenne runtime framework.
- Application code should not attempt to change them them. However it is allowed to read
- them, which provides valuable runtime information. E.g. ObjectId can be used for quick
- equality check of 2 objects, knowing persistence state would allow highlighting changed
- objects, etc.</p><p>Each persistent object belongs to a single ObjectContext, and can be in one of the following
- persistence states (as defined in <code class="code">org.apache.cayenne.PersistenceState</code>)
- :</p><table frame="void" id="d0e1012"><caption>Table 6.1. Persistence States</caption><col width="16%"><col width="84%"><tbody><tr>
- <td>TRANSIENT</td>
- <td>The object is not registered with an ObjectContext and will not be
- persisted.</td>
- </tr><tr>
- <td>NEW</td>
- <td>The object is freshly registered in an ObjectContext, but has not been
- saved to the database yet and there is no matching database row.</td>
- </tr><tr>
- <td>COMMITTED</td>
- <td>The object is registered in an ObjectContext, there is a row in the
- database corresponding to this object, and the object state corresponds
- to the last known state of the matching database row.</td>
- </tr><tr>
- <td>MODIFIED</td>
- <td>The object is registered in an ObjectContext, there is a row in the
- database corresponding to this object, but the object in-memory state
- has diverged from the last known state of the matching database
- row.</td>
- </tr><tr>
- <td>HOLLOW</td>
- <td>The object is registered in an ObjectContext, there is a row in the
- database corresponding to this object, but the object state is unknown.
- Whenever an application tries to access a property of such object,
- Cayenne attempts reading its values from the database and "inflate" the
- object, turning it to COMMITED.</td>
- </tr><tr>
- <td>DELETED</td>
- <td>The object is registered in an ObjectContext and has been marked for
- deletion in-memory. The corresponding row in the database will get
- deleted upon ObjectContext commit, and the object state will be turned
- into TRANSIENT.</td>
- </tr></tbody></table></div><div class="section" title="ObjectContext Persistence API"><div class="titlepage"><div><div><h2 class="title"><a name="persistent-operations"></a>ObjectContext Persistence API</h2></div></div></div><p>One of the first things users usually want to do with an ObjectContext is to select
- some objects from a database. This is done by calling "<span class="italic">performQuery</span>"
- method:</p><pre class="programlisting">SelectQuery query = new SelectQuery(Artist.class);
+ provides the API to execute database operations and to manage persistent objects. A
+ context is obtained from the
+ ServerRuntime:</p><pre class="programlisting">ObjectContext context = runtime.getContext();</pre><p>The call above creates a new instance of ObjectContext that can access the database via this
+ runtime. ObjectContext is a single "work area" in Cayenne, storing persistent objects.
+ ObjectContext guarantees that for each database row with a unique ID it will contain at
+ most one instance of an object, thus ensuring object graph consistency between multiple
+ selects (a feature called "uniquing"). At the same time different ObjectContexts will
+ have independent copies of objects for each unique database row. This allows users to
+ isolate object changes from one another by using separate ObjectContexts.</p><p>These properties directly affect the strategies for scoping and sharing (or not
+ sharing) ObjectContexts. Contexts that are only used to fetch objects from the database
+ and whose objects are never modified by the application can be shared between mutliple
+ users (and multiple threads). Contexts that store modified objects should be accessed
+ only by a single user (e.g. a web application user might reuse a context instance
+ between multiple web requests in the same HttpSession, thus carrying uncommitted changes
+ to objects from request to request, until he decides to commit or rollback them). Even
+ for a single user it might make sense to use mutliple ObjectContexts (e.g.
+ request-scoped contexts to allow concurrent requests from the browser that change and
+ commit objects independently).</p><p>ObjectContext is serializable and does not permanently hold to any of the application
+ resources. So it does not have to be closed. If the context is not used anymore, it
+ should simply be allowed to go out of scope and get garbage collected, just like any
+ other Java object.</p></div><div class="section" title="Persistent Object and its Lifecycle"><div class="titlepage"><div><div><h2 class="title"><a name="persistent-lifecycle"></a>Persistent Object and its Lifecycle</h2></div></div></div><p>Cayenne can persist Java objects that implement <code class="code">org.apache.cayenne.Persistent</code>
+ interface. Generally persistent classes are generated from the model as described above,
+ so users do not have to worry about superclass and property implementation details. </p><p>Persistent interface provides access to 3 persistence-related properties - objectId,
+ persistenceState and objectContext. All 3 are initialized by Cayenne runtime framework.
+ Application code should not attempt to change them them. However it is allowed to read
+ them, which provides valuable runtime information. E.g. ObjectId can be used for quick
+ equality check of 2 objects, knowing persistence state would allow highlighting changed
+ objects, etc.</p><p>Each persistent object belongs to a single ObjectContext, and can be in one of the following
+ persistence states (as defined in <code class="code">org.apache.cayenne.PersistenceState</code>)
+ :</p><table frame="void" id="d0e1017"><caption>Table 6.1. Persistence States</caption><col width="16%"><col width="84%"><tbody><tr>
+ <td>TRANSIENT</td>
+ <td>The object is not registered with an ObjectContext and will not be
+ persisted.</td>
+ </tr><tr>
+ <td>NEW</td>
+ <td>The object is freshly registered in an ObjectContext, but has not been
+ saved to the database yet and there is no matching database row.</td>
+ </tr><tr>
+ <td>COMMITTED</td>
+ <td>The object is registered in an ObjectContext, there is a row in the
+ database corresponding to this object, and the object state corresponds
+ to the last known state of the matching database row.</td>
+ </tr><tr>
+ <td>MODIFIED</td>
+ <td>The object is registered in an ObjectContext, there is a row in the
+ database corresponding to this object, but the object in-memory state
+ has diverged from the last known state of the matching database
+ row.</td>
+ </tr><tr>
+ <td>HOLLOW</td>
+ <td>The object is registered in an ObjectContext, there is a row in the
+ database corresponding to this object, but the object state is unknown.
+ Whenever an application tries to access a property of such object,
+ Cayenne attempts reading its values from the database and "inflate" the
+ object, turning it to COMMITED.</td>
+ </tr><tr>
+ <td>DELETED</td>
+ <td>The object is registered in an ObjectContext and has been marked for
+ deletion in-memory. The corresponding row in the database will get
+ deleted upon ObjectContext commit, and the object state will be turned
+ into TRANSIENT.</td>
+ </tr></tbody></table></div><div class="section" title="ObjectContext Persistence API"><div class="titlepage"><div><div><h2 class="title"><a name="persistent-operations"></a>ObjectContext Persistence API</h2></div></div></div><p>One of the first things users usually want to do with an ObjectContext is to select
+ some objects from a database. This is done by calling "<span class="italic">performQuery</span>"
+ method:</p><pre class="programlisting">SelectQuery query = <span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">new</span> SelectQuery(Artist.<span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">class</span>);
List<Artist> artists = context.performQuery(query);</pre><p>We'll
- discuss queries in some detail in the following chapters. The example above is
- self-explanatory - we create a SelectQuery that matches all Artist objects present in
- the database, and then call "performQuery", getting a list of Artist objects.</p><p>Some queries can be quite complex, returning multiple result sets or even updating the
- database. For such queries ObjectContext provides "<span class="italic">performGenericQuery</span>"method. While not nearly as commonly-used as
- "performQuery", it is nevertheless important in some situations.
- E.g.:</p><pre class="programlisting">Collection<Query> queries = ... // multiple queries that need to be run together
-QueryChain query = new QueryChain(queries);
+ discuss queries in some detail in the following chapters. The example above is
+ self-explanatory - we create a SelectQuery that matches all Artist objects present in
+ the database, and then call "performQuery", getting a list of Artist objects.</p><p>Some queries can be quite complex, returning multiple result sets or even updating the
+ database. For such queries ObjectContext provides "<span class="italic">performGenericQuery</span>"method. While not nearly as commonly-used as
+ "performQuery", it is nevertheless important in some situations.
+ E.g.:</p><pre class="programlisting">Collection<Query> queries = ... <span xmlns="http://www.w3.org/1999/xhtml" class="hl-comment">// multiple queries that need to be run together</span>
+QueryChain query = <span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">new</span> QueryChain(queries);
-QueryResponse response = context.performGenericQuery(query);</pre><p>An application might modify selected objects. E.g.:</p><pre class="programlisting">Artist selectedArtist = artists.get(0);
-selectedArtist.setName("Dali");</pre><p>The first time the object property is changed, the object's state is automatically set
- to "MODIFIED" by Cayenne. Cayenne tracks all in-memory changes until a user calls
- "<span class="italic">commitChanges</span>":</p><pre class="programlisting">context.commitChanges();</pre><p>At
- this point all in-memory changes are analyzed and a minimal set of SQL statements is
- issued in a single transaction to synchronize the database with the in-memory state. In
- our example "commitChanges" commits just one object, but generally it can be any number
- of objects. </p><p>If instead of commit, we wanted to reset all changed objects to the previously
- committed state, we'd call <span class="emphasis"><em>rollbackChanges</em></span>
- instead:</p><pre class="programlisting">context.rollbackChanges();</pre><p>"<span class="italic">newObject</span>" method call creates a persistent object
- and sets its state to
- "NEW":</p><pre class="programlisting">Artist newArtist = context.newObject(Artist.class);
-newArtist.setName("Picasso");</pre><p>It will only exist in memory until "commitChanges" is issued. On commit Cayenne might
- generate a new primary key (unless a user set it explicitly, or a PK was inferred from a
- relationship) and issue an INSERT SQL statement to permanently store the object.</p><p><span class="emphasis"><em>deleteObjects</em></span> method takes one or more Persistent objects and
- marks them as
- "DELETED":</p><pre class="programlisting">context.deleteObjects(artist1);
+QueryResponse response = context.performGenericQuery(query);</pre><p>An application might modify selected objects. E.g.:</p><pre class="programlisting">Artist selectedArtist = artists.get(<span xmlns="http://www.w3.org/1999/xhtml" class="hl-number">0</span>);
+selectedArtist.setName(<span xmlns="http://www.w3.org/1999/xhtml" class="hl-string">"Dali"</span>);</pre><p>The first time the object property is changed, the object's state is automatically set
+ to "MODIFIED" by Cayenne. Cayenne tracks all in-memory changes until a user calls
+ "<span class="italic">commitChanges</span>":</p><pre class="programlisting">context.commitChanges();</pre><p>At
+ this point all in-memory changes are analyzed and a minimal set of SQL statements is
+ issued in a single transaction to synchronize the database with the in-memory state. In
+ our example "commitChanges" commits just one object, but generally it can be any number
+ of objects. </p><p>If instead of commit, we wanted to reset all changed objects to the previously
+ committed state, we'd call <span class="emphasis"><em>rollbackChanges</em></span>
+ instead:</p><pre class="programlisting">context.rollbackChanges();</pre><p>"<span class="italic">newObject</span>" method call creates a persistent object
+ and sets its state to
+ "NEW":</p><pre class="programlisting">Artist newArtist = context.newObject(Artist.<span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">class</span>);
+newArtist.setName(<span xmlns="http://www.w3.org/1999/xhtml" class="hl-string">"Picasso"</span>);</pre><p>It will only exist in memory until "commitChanges" is issued. On commit Cayenne might
+ generate a new primary key (unless a user set it explicitly, or a PK was inferred from a
+ relationship) and issue an INSERT SQL statement to permanently store the object.</p><p><span class="emphasis"><em>deleteObjects</em></span> method takes one or more Persistent objects and
+ marks them as
+ "DELETED":</p><pre class="programlisting">context.deleteObjects(artist1);
context.deleteObjects(artist2, artist3, artist4);</pre><p>Additionally
- "deleteObjects" processes all delete rules modeled for the affected objects. This may
- result in implicitly deleting or modifying extra related objects. Same as insert and
- update, delete operations are sent to the database only when "commitChanges" is called.
- Similarly "rollbackChanges" will undo the effect of "newObject" and
- "deleteObjects".</p><p><span class="emphasis"><em>localObject</em></span> returns a copy of a given persistent object that is
- "local" to a given ObjectContext:</p><p>Since an application often works with more than one context, "localObject" is a rather
- common operation. E.g. to improve performance a user might utilize a single shared
- context to select and cache data, and then occasionally transfer some selected objects
- to another context to modify and commit
- them:</p><pre class="programlisting">ObjectContext editingContext = runtime.getContext();
+ "deleteObjects" processes all delete rules modeled for the affected objects. This may
+ result in implicitly deleting or modifying extra related objects. Same as insert and
+ update, delete operations are sent to the database only when "commitChanges" is called.
+ Similarly "rollbackChanges" will undo the effect of "newObject" and
+ "deleteObjects".</p><p><span class="emphasis"><em>localObject</em></span> returns a copy of a given persistent object that is
+ "local" to a given ObjectContext:</p><p>Since an application often works with more than one context, "localObject" is a rather
+ common operation. E.g. to improve performance a user might utilize a single shared
+ context to select and cache data, and then occasionally transfer some selected objects
+ to another context to modify and commit
+ them:</p><pre class="programlisting">ObjectContext editingContext = runtime.getContext();
Artist localArtist = editingContext.localObject(artist);</pre><p>Often an appliction needs to inspect mapping metadata. This information is stored in
- the EntityResolver object, accessible via the
- ObjectContext:</p><pre class="programlisting">EntityResolver resolver = objectContext.getEntityResolver();</pre><p>Here we discussed the most commonly used subset of the ObjectContext API. There are
- other useful methods, e.g. those allowing to inspect registered objects state en bulk,
- etc. Check the latest JavaDocs for details.</p></div><div class="section" title="Cayenne Helper Class"><div class="titlepage"><div><div><h2 class="title"><a name="cayenne-helper-class"></a>Cayenne Helper Class</h2></div></div></div><p>There is a useful helper class called "Cayenne" (fully-qualified name
- <code class="code">"org.apache.cayenne.Cayenne"</code>) that builds on ObjectContext API to
- provide a number of very common operations. E.g. get a primary key (most entities do not
- model PK as an object property)
- :</p><pre class="programlisting">long pk = Cayenne.longPKForObject(artist);</pre><p>It also provides the reverse operation - finding an object given a known
- PK:</p><pre class="programlisting">Artist artist = Cayenne.objectForPK(context, Artist.class, 34579);</pre><p>If a query is expected to return 0 or 1 object, Cayenne helper class can be used to find
- this object. It throws an exception if more than one object matched the
- query:</p><pre class="programlisting">Artist artist = (Artist) Cayenne.objectForQuery(context, new SelectQuery(Artist.class));</pre><p>Feel free to explore Cayenne class API for other useful methods.</p></div><div class="section" title="ObjectContext Nesting"><div class="titlepage"><div><div><h2 class="title"><a name="objectcontext-nesting"></a>ObjectContext Nesting</h2></div></div></div><p>In all the examples shown so far an ObjectContext would directly connect to a database
- to select data or synchronize its state (either via commit or rollback). However another
- context can be used in all these scenarios instead of a database. This concept is called
- ObjectContext "nesting". Nesting is a parent/child relationship between two contexts,
- where child is a nested context and selects or commits its objects via a parent. </p><p>Nesting is useful to create isolated object editing areas (child contexts) that need
- to all be committed to an intermediate in-memory store (parent context), or rolled back
- without affecting changes already recorded in the parent. Think cascading GUI dialogs,
- or parallel AJAX requests coming to the same session.</p><p>In theory Cayenne supports any number of nesting levels, however applications should
- generally stay with one or two, as deep hierarchies will most certainly degrade the
- performance of the deeply nested child contexts. This is due to the fact that each
- context in a nesting chain has to update its own objects during most operations. </p><p>Cayenne ROP is an extreme case of nesting when a child context is located in a
- separate JVM and communicates with its parent via a web service. ROP is discussed in
- details in the following chapters. Here we concentrate on the same-VM nesting.</p><p>To create a nested context, use an instance of ServerRuntime, passing it the desired
- parent:</p><pre class="programlisting">ObjectContext parent = runtime.getContext();
+ the EntityResolver object, accessible via the
+ ObjectContext:</p><pre class="programlisting">EntityResolver resolver = objectContext.getEntityResolver();</pre><p>Here we discussed the most commonly used subset of the ObjectContext API. There are
+ other useful methods, e.g. those allowing to inspect registered objects state en bulk,
+ etc. Check the latest JavaDocs for details.</p></div><div class="section" title="Cayenne Helper Class"><div class="titlepage"><div><div><h2 class="title"><a name="cayenne-helper-class"></a>Cayenne Helper Class</h2></div></div></div><p>There is a useful helper class called "Cayenne" (fully-qualified name
+ <code class="code">"org.apache.cayenne.Cayenne"</code>) that builds on ObjectContext API to
+ provide a number of very common operations. E.g. get a primary key (most entities do not
+ model PK as an object property)
+ :</p><pre class="programlisting"><span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">long</span> pk = Cayenne.longPKForObject(artist);</pre><p>It also provides the reverse operation - finding an object given a known
+ PK:</p><pre class="programlisting">Artist artist = Cayenne.objectForPK(context, Artist.<span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">class</span>, <span xmlns="http://www.w3.org/1999/xhtml" class="hl-number">34579</span>);</pre><p>If a query is expected to return 0 or 1 object, Cayenne helper class can be used to find
+ this object. It throws an exception if more than one object matched the
+ query:</p><pre class="programlisting">Artist artist = (Artist) Cayenne.objectForQuery(context, <span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">new</span> SelectQuery(Artist.<span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">class</span>));</pre><p>Feel free to explore Cayenne class API for other useful methods.</p></div><div class="section" title="ObjectContext Nesting"><div class="titlepage"><div><div><h2 class="title"><a name="objectcontext-nesting"></a>ObjectContext Nesting</h2></div></div></div><p>In all the examples shown so far an ObjectContext would directly connect to a database
+ to select data or synchronize its state (either via commit or rollback). However another
+ context can be used in all these scenarios instead of a database. This concept is called
+ ObjectContext "nesting". Nesting is a parent/child relationship between two contexts,
+ where child is a nested context and selects or commits its objects via a parent. </p><p>Nesting is useful to create isolated object editing areas (child contexts) that need
+ to all be committed to an intermediate in-memory store (parent context), or rolled back
+ without affecting changes already recorded in the parent. Think cascading GUI dialogs,
+ or parallel AJAX requests coming to the same session.</p><p>In theory Cayenne supports any number of nesting levels, however applications should
+ generally stay with one or two, as deep hierarchies will most certainly degrade the
+ performance of the deeply nested child contexts. This is due to the fact that each
+ context in a nesting chain has to update its own objects during most operations. </p><p>Cayenne ROP is an extreme case of nesting when a child context is located in a
+ separate JVM and communicates with its parent via a web service. ROP is discussed in
+ details in the following chapters. Here we concentrate on the same-VM nesting.</p><p>To create a nested context, use an instance of ServerRuntime, passing it the desired
+ parent:</p><pre class="programlisting">ObjectContext parent = runtime.getContext();
ObjectContext nested = runtime.getContext((DataChannel) parent);</pre><p>From
- here a nested context operates just like a regular context (you can perform queries,
- create and delete objects, etc.). The only difference is that commit and rollback
- operations can either be limited to synchronization with the parent, or cascade all the
- way to the
- database:</p><pre class="programlisting">// merges nested context changes into the parent context
+ here a nested context operates just like a regular context (you can perform queries,
+ create and delete objects, etc.). The only difference is that commit and rollback
+ operations can either be limited to synchronization with the parent, or cascade all the
+ way to the
+ database:</p><pre class="programlisting"><span xmlns="http://www.w3.org/1999/xhtml" class="hl-comment">// merges nested context changes into the parent context</span>
nested.commitChangesToParent();
-// regular 'commitChanges' cascades commit through the chain
-// of parent contexts all the way to the database
-nested.commitChanges();</pre><pre class="programlisting">// unrolls all local changes, getting context in a state identical to parent
+<span xmlns="http://www.w3.org/1999/xhtml" class="hl-comment">// regular 'commitChanges' cascades commit through the chain </span>
+<span xmlns="http://www.w3.org/1999/xhtml" class="hl-comment">// of parent contexts all the way to the database</span>
+nested.commitChanges();</pre><pre class="programlisting"><span xmlns="http://www.w3.org/1999/xhtml" class="hl-comment">// unrolls all local changes, getting context in a state identical to parent</span>
nested.rollbackChangesLocally();
-// regular 'rollbackChanges' cascades rollback through the chain of contexts
-// all the way to the topmost parent
+<span xmlns="http://www.w3.org/1999/xhtml" class="hl-comment">// regular 'rollbackChanges' cascades rollback through the chain of contexts </span>
+<span xmlns="http://www.w3.org/1999/xhtml" class="hl-comment">// all the way to the topmost parent</span>
nested.rollbackChanges();</pre></div><div class="section" title="Generic Persistent Objects"><div class="titlepage"><div><div><h2 class="title"><a name="generic-persistent-objects"></a>Generic Persistent Objects</h2></div></div></div><p>As described in the CayenneModeler chapter, Cayenne supports mapping of completely
- generic classes to specific entities. Although for conveniece most applications should
- stick with entity-specific class mappings, the generic feature offers some interesting
- possibilities, such as creating mappings completely on the fly in a running application,
- etc.</p><p>Generic objects are first class citizens in Cayenne, and all common persistent
- operations apply to them as well. There are some pecularities however, described
- below.</p><p>When creating a new generic object, either cast your ObjectContext to DataContext
- (that provides "newObject(String)" API), or provide your object with an explicit
- ObjectId:</p><pre class="programlisting">DataObject generic = ((DataContext) context).newObject("GenericEntity");</pre><pre class="programlisting">DataObject generic = new CayenneDataObject();
-generic.setObjectId(new ObjectId("GenericEntity"));
+ generic classes to specific entities. Although for conveniece most applications should
+ stick with entity-specific class mappings, the generic feature offers some interesting
+ possibilities, such as creating mappings completely on the fly in a running application,
+ etc.</p><p>Generic objects are first class citizens in Cayenne, and all common persistent
+ operations apply to them as well. There are some pecularities however, described
+ below.</p><p>When creating a new generic object, either cast your ObjectContext to DataContext
+ (that provides "newObject(String)" API), or provide your object with an explicit
+ ObjectId:</p><pre class="programlisting">DataObject generic = ((DataContext) context).newObject(<span xmlns="http://www.w3.org/1999/xhtml" class="hl-string">"GenericEntity"</span>);</pre><pre class="programlisting">DataObject generic = <span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">new</span> CayenneDataObject();
+generic.setObjectId(<span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">new</span> ObjectId(<span xmlns="http://www.w3.org/1999/xhtml" class="hl-string">"GenericEntity"</span>));
context.registerNewObject(generic);</pre><p>SelectQuery
- for generic object should be created passing entity name String in constructor, instead
- of a Java
- class:</p><pre class="programlisting">SelectQuery query = new SelectQuery("GenericEntity");</pre><p>Use
- DataObject API to access and modify properties of a generic
- object:</p><pre class="programlisting">String name = (String) generic.readProperty("name");
-generic.writeProperty("name", "New Name");</pre><p>This
- is how an application can obtain entity name of a generic
- object:</p><pre class="programlisting">String entityName = generic.getObjectId().getEntityName();</pre></div><div class="section" title="Transactions"><div class="titlepage"><div><div><h2 class="title"><a name="transactions"></a>Transactions</h2></div></div></div><p>Considering how much attention is given to managing transactions in most other ORMs,
- transactions have been conspicuously absent from the ObjectContext discussion till now.
- The reason is that transactions are seamless in Cayenne in all but a few special cases.
- ObjectContext is an in-memory container of objects that is disconnected from the
- database, except when it needs to run an operation. So it does not care about any
- surrounding transaction scope. Sure enough all database operations are transactional, so
- when an application does a commit, all SQL execution is wrapped in a database
- transaction. But this is done behind the scenes and is rarely a concern to the
- application code.</p><p>Two cases where transactions need to be taken into consideration are container-managed
- and application-managed transactions. </p><p>If you are using an EJB container (or some other JTA environment), you'll likely need
- to switch Cayenne runtime into "external transactions mode". This is either done in the
- Modeler (check DataDomain > 'Container-Managed Transactions' checkbox), or in the
- code:</p><pre class="programlisting">runtime.getDataDomain().setUsingExternalTransactions(true);</pre><p>In
- this case Cayenne assumes that JDBC Connections obtained by runtime whenever that might
- happen are all coming from a transactional DataSource managed by the container. In this
- case Cayenne does not attempt to commit or rollback the connections, leaving it up to
- the container to do that when appropriate.</p><p>In the second scenario, an application might need to define its own transaction scope
- that spans more than one Cayenne operation. E.g. two sequential commits that need to be
- rolled back together in case of failure. This can be done with an explicit thread-bound
- transaction that surrounds a set of operations. Application is responsible for
- committing or rolling it
- back:</p><pre class="programlisting">Transaction tx = runtime.getDataDomain().createTransaction();
+ for generic object should be created passing entity name String in constructor, instead
+ of a Java
+ class:</p><pre class="programlisting">SelectQuery query = <span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">new</span> SelectQuery(<span xmlns="http://www.w3.org/1999/xhtml" class="hl-string">"GenericEntity"</span>);</pre><p>Use
+ DataObject API to access and modify properties of a generic
+ object:</p><pre class="programlisting">String name = (String) generic.readProperty(<span xmlns="http://www.w3.org/1999/xhtml" class="hl-string">"name"</span>);
+generic.writeProperty(<span xmlns="http://www.w3.org/1999/xhtml" class="hl-string">"name"</span>, <span xmlns="http://www.w3.org/1999/xhtml" class="hl-string">"New Name"</span>);</pre><p>This
+ is how an application can obtain entity name of a generic
+ object:</p><pre class="programlisting">String entityName = generic.getObjectId().getEntityName();</pre></div><div class="section" title="Transactions"><div class="titlepage"><div><div><h2 class="title"><a name="transactions"></a>Transactions</h2></div></div></div><p>Considering how much attention is given to managing transactions in most other ORMs,
+ transactions have been conspicuously absent from the ObjectContext discussion till now.
+ The reason is that transactions are seamless in Cayenne in all but a few special cases.
+ ObjectContext is an in-memory container of objects that is disconnected from the
+ database, except when it needs to run an operation. So it does not care about any
+ surrounding transaction scope. Sure enough all database operations are transactional, so
+ when an application does a commit, all SQL execution is wrapped in a database
+ transaction. But this is done behind the scenes and is rarely a concern to the
+ application code.</p><p>Two cases where transactions need to be taken into consideration are container-managed
+ and application-managed transactions. </p><p>If you are using an EJB container (or some other JTA environment), you'll likely need
+ to switch Cayenne runtime into "external transactions mode". This is either done in the
+ Modeler (check DataDomain > 'Container-Managed Transactions' checkbox), or in the
+ code:</p><pre class="programlisting">runtime.getDataDomain().setUsingExternalTransactions(true);</pre><p>In
+ this case Cayenne assumes that JDBC Connections obtained by runtime whenever that might
+ happen are all coming from a transactional DataSource managed by the container. In this
+ case Cayenne does not attempt to commit or rollback the connections, leaving it up to
+ the container to do that when appropriate.</p><p>In the second scenario, an application might need to define its own transaction scope
+ that spans more than one Cayenne operation. E.g. two sequential commits that need to be
+ rolled back together in case of failure. This can be done with an explicit thread-bound
+ transaction that surrounds a set of operations. Application is responsible for
+ committing or rolling it
+ back:</p><pre class="programlisting">Transaction tx = runtime.getDataDomain().createTransaction();
Transaction.bindThreadTransaction(tx);
-try {
- // commit one or more contexts
+<span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">try</span> {
+ <span xmlns="http://www.w3.org/1999/xhtml" class="hl-comment">// commit one or more contexts</span>
context1.commitChanges();
context2.commitChanges();
....
- // after changing some objects in context1, commit again
+ <span xmlns="http://www.w3.org/1999/xhtml" class="hl-comment">// after changing some objects in context1, commit again</span>
context1.commitChnages();
....
- // if no failures, commit
+ <span xmlns="http://www.w3.org/1999/xhtml" class="hl-comment">// if no failures, commit</span>
tx.commit();
}
-catch (Exception ex) {
+<span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">catch</span> (Exception ex) {
tx.setRollbackOnly();
}
-finally {
+<span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">finally</span> {
Transaction.bindThreadTransaction(null);
- if (tx.getStatus() == Transaction.STATUS_MARKED_ROLLEDBACK) {
- try {
+ <span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">if</span> (tx.getStatus() == Transaction.STATUS_MARKED_ROLLEDBACK) {
+ <span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">try</span> {
tx.rollback();
}
- catch (Exception rollbackEx) {
+ <span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">catch</span> (Exception rollbackEx) {
}
}
} </pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="starting-cayenne.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="cayenne-guide-part2.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="expressions.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 5. Starting Cayenne </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 7. Expressions</td></tr></table></div></body></html>
\ No newline at end of file
Modified: cayenne/site/cms/trunk/content/docs/3.1/cayenne-guide/queries.html
URL: http://svn.apache.org/viewvc/cayenne/site/cms/trunk/content/docs/3.1/cayenne-guide/queries.html?rev=1425994&r1=1425993&r2=1425994&view=diff
==============================================================================
--- cayenne/site/cms/trunk/content/docs/3.1/cayenne-guide/queries.html (original)
+++ cayenne/site/cms/trunk/content/docs/3.1/cayenne-guide/queries.html Wed Dec 26 19:20:15 2012
@@ -1,35 +1,35 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Chapter 9. Queries</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="Cayenne Guide"><link rel="up" href="cayenne-guide-part2.html" title="Part II. Cayenne Framework"><link rel="prev" href="orderings.html" title="Chapter 8. Orderings"><link rel="next" href="lifecycle-events.html" title="Chapter 10. Lifecycle Events"></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. Queries</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="orderings.html">Prev</a> </td><th width="60%" align="center">Part II. Cayenne Framework</th><td width="20%" align="right"> <a accesskey="n" href="lifecycle-events.html">Next</a></t
d></tr></table><hr></div><div class="chapter" title="Chapter 9. Queries"><div class="titlepage"><div><div><h2 class="title"><a name="queries"></a>Chapter 9. Queries</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="queries.html#selectquery">SelectQuery</a></span></dt><dt><span class="section"><a href="queries.html#ejbqlquery">EJBQLQuery</a></span></dt><dt><span class="section"><a href="queries.html#sqltemplate">SQLTemplateQuery</a></span></dt><dt><span class="section"><a href="queries.html#procedurequery">ProcedureQuery</a></span></dt><dt><span class="section"><a href="queries.html#namedquery">NamedQuery</a></span></dt><dt><span class="section"><a href="queries.html#custom-queries">Custom Queries</a></span></dt></dl></div><p>Queries are Java objects used by the application to communicate with the database. Cayenne
- knows how to translate queries into SQL statements appropriate for a particular database
- engine. Most often queries are used to find objects matching certain criteria, but there are
- other types of queries too. E.g. those allowing to run native SQL, call DB stored
- procedures, etc. When committing objects, Cayenne itself creates special queries to
- insert/update/delete rows in the dabase.</p><p>There is a number of built-in queries in Cayenne, described later in this chapter. Users can
- also define their own query types to abstract certain DB interactions that for whatever
- reason can not be adequately described by the built-in set. </p><p>Queries can be roughly categorized as "object" and "native". Object queries (most notably
- SelectQuery and EJBQLQuery) are built with abstractions originating in the object model (the
- "object" side in the "object-relational" divide). E.g. SelectQuery is assembled from a Java
- class of the objects to fetch, a qualifier expression, orderings, etc. - all of this
- expressed in terms of the object model.</p><p>Native queries describe a desired DB operation as SQL code (SQLTemplate query) or a reference
- to a stored procedure (ProcedureQuery), etc. The results of native queries are usually
- presented as Lists of Maps, with each map representing a row in the DB. They can potentially
- be converted to objects, however often it takes a considerable effort to do so. Native
- queries are also less (if at all) portable across databases than object queries. </p><div class="section" title="SelectQuery"><div class="titlepage"><div><div><h2 class="title"><a name="selectquery"></a>SelectQuery</h2></div></div></div><p>SelectQuery is the most commonly used query in user applications. It returns a list of
- persistent objects of a certain type specified in the
- query:</p><pre class="programlisting">SelectQuery query = new SelectQuery(Artist.class);
+ knows how to translate queries into SQL statements appropriate for a particular database
+ engine. Most often queries are used to find objects matching certain criteria, but there are
+ other types of queries too. E.g. those allowing to run native SQL, call DB stored
+ procedures, etc. When committing objects, Cayenne itself creates special queries to
+ insert/update/delete rows in the dabase.</p><p>There is a number of built-in queries in Cayenne, described later in this chapter. Users can
+ also define their own query types to abstract certain DB interactions that for whatever
+ reason can not be adequately described by the built-in set. </p><p>Queries can be roughly categorized as "object" and "native". Object queries (most notably
+ SelectQuery and EJBQLQuery) are built with abstractions originating in the object model (the
+ "object" side in the "object-relational" divide). E.g. SelectQuery is assembled from a Java
+ class of the objects to fetch, a qualifier expression, orderings, etc. - all of this
+ expressed in terms of the object model.</p><p>Native queries describe a desired DB operation as SQL code (SQLTemplate query) or a reference
+ to a stored procedure (ProcedureQuery), etc. The results of native queries are usually
+ presented as Lists of Maps, with each map representing a row in the DB. They can potentially
+ be converted to objects, however often it takes a considerable effort to do so. Native
+ queries are also less (if at all) portable across databases than object queries. </p><div class="section" title="SelectQuery"><div class="titlepage"><div><div><h2 class="title"><a name="selectquery"></a>SelectQuery</h2></div></div></div><p>SelectQuery is the most commonly used query in user applications. It returns a list of
+ persistent objects of a certain type specified in the
+ query:</p><pre class="programlisting">SelectQuery query = <span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">new</span> SelectQuery(Artist.<span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">class</span>);
List<Artist> objects = context.performQuery(query);</pre><p>This
- returned all rows in the "ARTIST" table. If the logs were turned on, you might see the
- following SQL
- printed:</p><pre class="programlisting">INFO: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0
+ returned all rows in the "ARTIST" table. If the logs were turned on, you might see the
+ following SQL
+ printed:</p><pre class="programlisting">INFO: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0
INFO: === returned 5 row. - took 5 ms.</pre><p>This SQL was generated by Cayenne from the SelectQuery above. SelectQuery can use a
- qualifier to select only the data that you care about. Qualifier is simply an Expression
- (Expressions where discussed in the previous chapter). If you only want artists whose
- name begins with 'Pablo', you might use the following qualifier expression:
- </p><pre class="programlisting">SelectQuery query = new SelectQuery(Artist.class,
- ExpressionFactory.likeExp(Artist.NAME_PROPERTY, "Pablo%"));
+ qualifier to select only the data that you care about. Qualifier is simply an Expression
+ (Expressions where discussed in the previous chapter). If you only want artists whose
+ name begins with 'Pablo', you might use the following qualifier expression:
+ </p><pre class="programlisting">SelectQuery query = <span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">new</span> SelectQuery(Artist.<span xmlns="http://www.w3.org/1999/xhtml" class="hl-keyword">class</span>,
+ ExpressionFactory.likeExp(Artist.NAME_PROPERTY, <span xmlns="http://www.w3.org/1999/xhtml" class="hl-string">"Pablo%"</span>));
List<Artist> objects = context.performQuery(query);</pre><p>The
- SQL will look different this
- time:</p><pre class="programlisting">INFO: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0 WHERE t0.NAME LIKE ?
+ SQL will look different this
+ time:</p><pre class="programlisting">INFO: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0 WHERE t0.NAME LIKE ?
[bind: 1->NAME:'Pablo%']
INFO: === returned 1 row. - took 6 ms.</pre></div><div class="section" title="EJBQLQuery"><div class="titlepage"><div><div><h2 class="title"><a name="ejbqlquery"></a>EJBQLQuery</h2></div></div></div></div><div class="section" title="SQLTemplateQuery"><div class="titlepage"><div><div><h2 class="title"><a name="sqltemplate"></a>SQLTemplateQuery</h2></div></div></div></div><div class="section" title="ProcedureQuery"><div class="titlepage"><div><div><h2 class="title"><a name="procedurequery"></a>ProcedureQuery</h2></div></div></div></div><div class="section" title="NamedQuery"><div class="titlepage"><div><div><h2 class="title"><a name="namedquery"></a>NamedQuery</h2></div></div></div></div><div class="section" title="Custom Queries"><div class="titlepage"><div><div><h2 class="title"><a name="custom-queries"></a>Custom Queries</h2></div></div></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey=
"p" href="orderings.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="cayenne-guide-part2.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="lifecycle-events.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 8. Orderings </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 10. Lifecycle Events</td></tr></table></div></body></html>
\ No newline at end of file
Modified: cayenne/site/cms/trunk/content/docs/3.1/cayenne-guide/rop-deployment.html
URL: http://svn.apache.org/viewvc/cayenne/site/cms/trunk/content/docs/3.1/cayenne-guide/rop-deployment.html?rev=1425994&r1=1425993&r2=1425994&view=diff
==============================================================================
--- cayenne/site/cms/trunk/content/docs/3.1/cayenne-guide/rop-deployment.html (original)
+++ cayenne/site/cms/trunk/content/docs/3.1/cayenne-guide/rop-deployment.html Wed Dec 26 19:20:15 2012
@@ -1,18 +1,18 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Chapter 17. ROP Deployment</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="Cayenne Guide"><link rel="up" href="cayenne-guide-part3.html" title="Part III. Cayenne Framework - Remote Object Persistence"><link rel="prev" href="implementing-rop-client.html" title="Chapter 16. Implementing ROP Client"><link rel="next" href="current-limitations.html" title="Chapter 18. Current Limitations"></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 17. ROP Deployment</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="implementing-rop-client.html">Prev</a> </td><th width="60%" align="center">Part III. Cayenne Framework -
Remote Object Persistence </th><td width="20%" align="right"> <a accesskey="n" href="current-limitations.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 17. ROP Deployment"><div class="titlepage"><div><div><h2 class="title"><a name="rop-deployment"></a>Chapter 17. ROP Deployment</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="rop-deployment.html#deploying-rop-server">Deploying ROP Server</a></span></dt><dt><span class="section"><a href="rop-deployment.html#deploying-rop-client">Deploying ROP Client</a></span></dt><dt><span class="section"><a href="rop-deployment.html#rop-security">Security</a></span></dt></dl></div><div class="section" title="Deploying ROP Server"><div class="titlepage"><div><div><h2 class="title"><a name="deploying-rop-server"></a>Deploying ROP Server</h2></div></div></div><div class="note" title="Note" style="margin-left: 0.5in; margin-right:
0.5in;"><h3 class="title">Note</h3><p>Recent versions of Tomcat and Jetty containers (e.g. Tomcat 6 and 7, Jetty 8) contain code
- addressing a security concern related to "session fixation problem" by resetting the
- existing session ID of any request that requires BASIC authentcaition. If ROP
- service is protected with declarative security (see the the ROP tutorial and the
- following chapters on security), this feature prevents the ROP client from attaching
- to its session, resulting in MissingSessionExceptions. To solve that you will need
- to either switch to an alternative security mechanism, or disable "session fixation
- problem" protections of the container. E.g. the later can be achieved in Tomcat 7 by
- adding the following <span class="emphasis"><em>context.xml</em></span> file to the webapp's META-INF/
- directory:
- </p><pre class="programlisting"><Context>
- <Valve className="org.apache.catalina.authenticator.BasicAuthenticator"
- changeSessionIdOnAuthentication="false" />
+ addressing a security concern related to "session fixation problem" by resetting the
+ existing session ID of any request that requires BASIC authentcaition. If ROP
+ service is protected with declarative security (see the the ROP tutorial and the
+ following chapters on security), this feature prevents the ROP client from attaching
+ to its session, resulting in MissingSessionExceptions. To solve that you will need
+ to either switch to an alternative security mechanism, or disable "session fixation
+ problem" protections of the container. E.g. the later can be achieved in Tomcat 7 by
+ adding the following <span class="emphasis"><em>context.xml</em></span> file to the webapp's META-INF/
+ directory:
+ </p><pre class="programlisting"><Context>
+ <Valve className="org.apache.catalina.authenticator.BasicAuthenticator"
+ changeSessionIdOnAuthentication="false" />
</Context></pre><p>(The
- <Valve> tag can also be placed within the <Context> in any other locations
- used by Tomcat to load context configurations)</p></div></div><div class="section" title="Deploying ROP Client"><div class="titlepage"><div><div><h2 class="title"><a name="deploying-rop-client"></a>Deploying ROP Client</h2></div></div></div></div><div class="section" title="Security"><div class="titlepage"><div><div><h2 class="title"><a name="rop-security"></a>Security</h2></div></div></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="implementing-rop-client.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="cayenne-guide-part3.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="current-limitations.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 16. Implementing ROP Client </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="r
ight" valign="top"> Chapter 18. Current Limitations</td></tr></table></div></body></html>
\ No newline at end of file
+ <Valve> tag can also be placed within the <Context> in any other locations
+ used by Tomcat to load context configurations)</p></div></div><div class="section" title="Deploying ROP Client"><div class="titlepage"><div><div><h2 class="title"><a name="deploying-rop-client"></a>Deploying ROP Client</h2></div></div></div></div><div class="section" title="Security"><div class="titlepage"><div><div><h2 class="title"><a name="rop-security"></a>Security</h2></div></div></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="implementing-rop-client.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="cayenne-guide-part3.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="current-limitations.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 16. Implementing ROP Client </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="4
0%" align="right" valign="top"> Chapter 18. Current Limitations</td></tr></table></div></body></html>
\ No newline at end of file
Modified: cayenne/site/cms/trunk/content/docs/3.1/cayenne-guide/server-configuration-properties.html
URL: http://svn.apache.org/viewvc/cayenne/site/cms/trunk/content/docs/3.1/cayenne-guide/server-configuration-properties.html?rev=1425994&r1=1425993&r2=1425994&view=diff
==============================================================================
--- cayenne/site/cms/trunk/content/docs/3.1/cayenne-guide/server-configuration-properties.html (original)
+++ cayenne/site/cms/trunk/content/docs/3.1/cayenne-guide/server-configuration-properties.html Wed Dec 26 19:20:15 2012
@@ -1,135 +1,136 @@
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Appendix A. Configuration Properties</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="Cayenne Guide"><link rel="up" href="index.html" title="Cayenne Guide"><link rel="prev" href="current-limitations.html" title="Chapter 18. Current Limitations"><link rel="next" href="client-configuration-properties.html" title="Appendix B. Service Collections"></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">Appendix A. Configuration Properties</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="current-limitations.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="client-configura
tion-properties.html">Next</a></td></tr></table><hr></div><div class="appendix" title="Appendix A. Configuration Properties"><div class="titlepage"><div><div><h2 class="title"><a name="server-configuration-properties"></a>Appendix A. Configuration Properties</h2></div></div></div><p>Note that the property names below are defined as constants in
- <code class="code">org.apache.cayenne.configuration.Constants</code> interface. </p><p>
- </p><table frame="void" id="d0e1798"><caption>Table A.1. Configuration Properties Recognized by ServerRuntime and/or ClientRuntime</caption><col width="77%"><col width="10%"><col width="13%"><thead><tr>
- <th>Property</th>
- <th>Possible Values</th>
- <th>Default Value</th>
- </tr></thead><tbody><tr>
- <td><code class="code">cayenne.jdbc.driver[.domain_name.node_name]</code> - defines a JDBC driver class to
- use when creating a DataSource. If domain name and optionally - node name
- are specified, the setting overrides DataSource info just for this
- domain/node. Otherwise the override is applied to all domains/nodes in the
- system.</td>
- <td></td>
- <td>none, project DataNode configuration is used</td>
- </tr><tr>
- <td><code class="code">cayenne.jdbc.url[.domain_name.node_name] </code>- defines a DB URL to use when
- creating a DataSource. If domain name and optionally - node name are
- specified, the setting overrides DataSource info just for this domain/node.
- Otherwise the override is applied to all domains/nodes in the system.</td>
- <td></td>
- <td>none, project DataNode configuration is used</td>
- </tr><tr>
- <td><code class="code">cayenne.jdbc.username[.domain_name.node_name] </code>- defines a DB user name to use
- when creating a DataSource. If domain name and optionally - node name are
- specified, the setting overrides DataSource info just for this domain/node.
- Otherwise the override is applied to all domains/nodes in the system.</td>
- <td></td>
- <td>none, project DataNode configuration is used</td>
- </tr><tr>
- <td><code class="code">cayenne.jdbc.password[.domain_name.node_name]</code> - defines a DB password to use
- when creating a DataSource. If domain name and optionally - node name are
- specified, the setting overrides DataSource info just for this domain/node.
- Otherwise the override is applied to all domains/nodes in the system</td>
- <td></td>
- <td>none, project DataNode configuration is used</td>
- </tr><tr>
- <td><code class="code">cayenne.jdbc.min_connections[.domain_name.node_name]</code> - defines the DB
- connection pool minimal size. If domain name and optionally - node name are
- specified, the setting overrides DataSource info just for this domain/node.
- Otherwise the override is applied to all domains/nodes in the system</td>
- <td></td>
- <td>none, project DataNode configuration is used</td>
- </tr><tr>
- <td><code class="code">cayenne.jdbc.max_connections[.domain_name.node_name]</code> - defines the DB
- connection pool maximum size. If domain name and optionally - node name are
- specified, the setting overrides DataSource info just for this domain/node.
- Otherwise the override is applied to all domains/nodes in the system</td>
- <td></td>
- <td>none, project DataNode configuration is used</td>
- </tr><tr>
- <td><code class="code">cayenne.querycache.size</code> - An integer defining the maximum number of entries in
- the query cache. Note that not all QueryCache providers may respect this
- property. MapQueryCache uses it, but the rest would use alternative
- configuration methods.</td>
- <td>any positive int value</td>
- <td>2000</td>
- </tr><tr>
- <td><code class="code">cayenne.server.contexts_sync_strategy</code> - defines whether peer ObjectContexts
- should receive snapshot events after commits from other contexts. If true
- (default), the contexts would automatically synchronize their state with
- peers.</td>
- <td>true, false</td>
- <td>true</td>
- </tr><tr>
- <td><code class="code">cayenne.server.object_retain_strategy</code> - defines fetched objects retain
- strategy for ObjectContexts. When weak or soft strategy is used, objects
- retained by ObjectContext that have no local changes can potetially get
- garbage collected when JVM feels like doing it.</td>
- <td>weak, soft, hard</td>
- <td>weak</td>
- </tr><tr>
- <td><code class="code">cayenne.server.max_id_qualifier_size</code> - defines a maximum number of ID
- qualifiers in the WHERE clause of queries that are generated for paginated
- queries and for DISJOINT_BY_ID prefetch processing. This is needed to avoid
- hitting WHERE clause size limitations and memory usage efficiency.</td>
- <td>any positive int</td>
- <td>10000</td>
- </tr><tr>
- <td><code class="code">cayenne.rop.service_url</code> - defines the URL of the ROP server</td>
- <td></td>
- <td></td>
- </tr><tr>
- <td><code class="code">cayenne.rop.service_username</code> - defines the user name for an ROP client to
- login to an ROP server.</td>
- <td></td>
- </tr><tr>
- <td><code class="code">cayenne.rop.service_password</code> - defines the password for an ROP client to login
- to an ROP server.</td>
- <td></td>
- <td></td>
- </tr><tr>
- <td><code class="code">cayenne.rop.shared_session_name</code>- defines the name of the shared session that
- an ROP client wants to join on an ROP server. If omitted, a dedicated
- session is created.</td>
- <td></td>
- <td></td>
- </tr><tr>
- <td><code class="code">cayenne.rop.service.timeout</code> - a value in milliseconds for the
- ROP client-server connection read operation timeout</td>
- <td>any positive long value</td>
- <td></td>
- </tr><tr>
- <td><code class="code">cayenne.rop.channel_events</code> - defines whether client-side DataChannel should
- dispatch events to child ObjectContexts. If set to true, ObjectContexts will
- receive commit events and merge changes committed by peer contexts that
- passed through the common client DataChannel.</td>
- <td>true, false</td>
- <td>false</td>
- </tr><tr>
- <td><code class="code">cayenne.rop.context_change_events</code>- defines whether object property changes in
- the client context result in firing events. Client UI components can listen
- to these events and update the UI. Disabled by default.</td>
- <td>true, false</td>
- <td>false</td>
- </tr><tr>
- <td><code class="code">cayenne.rop.context_lifecycle_events</code> - defines whether object commit and
- rollback operations in the client context result in firing events. Client UI
- components can listen to these events and update the UI. Disabled by
- default.</td>
- <td>true,false</td>
- <td>false</td>
- </tr><tr>
- <td><code class="code">cayenne.server.rop_event_bridge_factory</code> - defines the name of
- the org.apache.cayenne.event.EventBridgeFactory that is passed from the ROP
- server to the client. I.e. server DI would provide a name of the factory,
- passing this name to the client via the wire. The client would instantiate
- it to receive events from the server. Note that this property is stored in
- "cayenne.server.rop_event_bridge_properties" map, not in the main
- "cayenne.properties".</td>
- <td></td>
- <td></td>
- </tr></tbody></table><p>
- </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="current-limitations.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="client-configuration-properties.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 18. Current Limitations </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Appendix B. Service Collections</td></tr></table></div></body></html>
\ No newline at end of file
+ <code class="code">org.apache.cayenne.configuration.Constants</code> interface. </p><p>
+ </p><table frame="void" id="d0e1805"><caption>Table A.1. Configuration Properties Recognized by ServerRuntime and/or ClientRuntime</caption><col width="67%"><col width="15%"><col width="18%"><thead><tr>
+ <th>Property</th>
+ <th>Possible Values</th>
+ <th>Default Value</th>
+ </tr></thead><tbody><tr>
+ <td><code class="code">cayenne.jdbc.driver[.domain_name.node_name]</code> - defines a JDBC driver class to
+ use when creating a DataSource. If domain name and optionally - node name
+ are specified, the setting overrides DataSource info just for this
+ domain/node. Otherwise the override is applied to all domains/nodes in the
+ system.</td>
+ <td></td>
+ <td>none, project DataNode configuration is used</td>
+ </tr><tr>
+ <td><code class="code">cayenne.jdbc.url[.domain_name.node_name] </code>- defines a DB URL to use when
+ creating a DataSource. If domain name and optionally - node name are
+ specified, the setting overrides DataSource info just for this domain/node.
+ Otherwise the override is applied to all domains/nodes in the system.</td>
+ <td></td>
+ <td>none, project DataNode configuration is used</td>
+ </tr><tr>
+ <td><code class="code">cayenne.jdbc.username[.domain_name.node_name] </code>- defines a DB user name to use
+ when creating a DataSource. If domain name and optionally - node name are
+ specified, the setting overrides DataSource info just for this domain/node.
+ Otherwise the override is applied to all domains/nodes in the system.</td>
+ <td></td>
+ <td>none, project DataNode configuration is used</td>
+ </tr><tr>
+ <td><code class="code">cayenne.jdbc.password[.domain_name.node_name]</code> - defines a DB password to use
+ when creating a DataSource. If domain name and optionally - node name are
+ specified, the setting overrides DataSource info just for this domain/node.
+ Otherwise the override is applied to all domains/nodes in the system</td>
+ <td></td>
+ <td>none, project DataNode configuration is used</td>
+ </tr><tr>
+ <td><code class="code">cayenne.jdbc.min_connections[.domain_name.node_name]</code> - defines the DB
+ connection pool minimal size. If domain name and optionally - node name are
+ specified, the setting overrides DataSource info just for this domain/node.
+ Otherwise the override is applied to all domains/nodes in the system</td>
+ <td></td>
+ <td>none, project DataNode configuration is used</td>
+ </tr><tr>
+ <td><code class="code">cayenne.jdbc.max_connections[.domain_name.node_name]</code> - defines the DB
+ connection pool maximum size. If domain name and optionally - node name are
+ specified, the setting overrides DataSource info just for this domain/node.
+ Otherwise the override is applied to all domains/nodes in the system</td>
+ <td></td>
+ <td>none, project DataNode configuration is used</td>
+ </tr><tr>
+ <td><code class="code">cayenne.querycache.size</code> - An integer defining the maximum number of entries in
+ the query cache. Note that not all QueryCache providers may respect this
+ property. MapQueryCache uses it, but the rest would use alternative
+ configuration methods.</td>
+ <td>any positive int value</td>
+ <td>2000</td>
+ </tr><tr>
+ <td><code class="code">cayenne.server.contexts_sync_strategy</code> - defines whether peer ObjectContexts
+ should receive snapshot events after commits from other contexts. If true
+ (default), the contexts would automatically synchronize their state with
+ peers.</td>
+ <td>true, false</td>
+ <td>true</td>
+ </tr><tr>
+ <td><code class="code">cayenne.server.object_retain_strategy</code> - defines fetched objects retain
+ strategy for ObjectContexts. When weak or soft strategy is used, objects
+ retained by ObjectContext that have no local changes can potetially get
+ garbage collected when JVM feels like doing it.</td>
+ <td>weak, soft, hard</td>
+ <td>weak</td>
+ </tr><tr>
+ <td><code class="code">cayenne.server.max_id_qualifier_size</code> - defines a maximum number of ID
+ qualifiers in the WHERE clause of queries that are generated for paginated
+ queries and for DISJOINT_BY_ID prefetch processing. This is needed to avoid
+ hitting WHERE clause size limitations and memory usage efficiency.</td>
+ <td>any positive int</td>
+ <td>10000</td>
+ </tr><tr>
+ <td><code class="code">cayenne.rop.service_url</code> - defines the URL of the ROP server</td>
+ <td></td>
+ <td></td>
+ </tr><tr>
+ <td><code class="code">cayenne.rop.service_username</code> - defines the user name for an ROP client to
+ login to an ROP server.</td>
+ <td></td>
+ <td></td>
+ </tr><tr>
+ <td><code class="code">cayenne.rop.service_password</code> - defines the password for an ROP client to login
+ to an ROP server.</td>
+ <td></td>
+ <td></td>
+ </tr><tr>
+ <td><code class="code">cayenne.rop.shared_session_name</code>- defines the name of the shared session that
+ an ROP client wants to join on an ROP server. If omitted, a dedicated
+ session is created.</td>
+ <td></td>
+ <td></td>
+ </tr><tr>
+ <td><code class="code">cayenne.rop.service.timeout</code> - a value in milliseconds for the
+ ROP client-server connection read operation timeout</td>
+ <td>any positive long value</td>
+ <td></td>
+ </tr><tr>
+ <td><code class="code">cayenne.rop.channel_events</code> - defines whether client-side DataChannel should
+ dispatch events to child ObjectContexts. If set to true, ObjectContexts will
+ receive commit events and merge changes committed by peer contexts that
+ passed through the common client DataChannel.</td>
+ <td>true, false</td>
+ <td>false</td>
+ </tr><tr>
+ <td><code class="code">cayenne.rop.context_change_events</code>- defines whether object property changes in
+ the client context result in firing events. Client UI components can listen
+ to these events and update the UI. Disabled by default.</td>
+ <td>true, false</td>
+ <td>false</td>
+ </tr><tr>
+ <td><code class="code">cayenne.rop.context_lifecycle_events</code> - defines whether object commit and
+ rollback operations in the client context result in firing events. Client UI
+ components can listen to these events and update the UI. Disabled by
+ default.</td>
+ <td>true,false</td>
+ <td>false</td>
+ </tr><tr>
+ <td><code class="code">cayenne.server.rop_event_bridge_factory</code> - defines the name of
+ the org.apache.cayenne.event.EventBridgeFactory that is passed from the ROP
+ server to the client. I.e. server DI would provide a name of the factory,
+ passing this name to the client via the wire. The client would instantiate
+ it to receive events from the server. Note that this property is stored in
+ "cayenne.server.rop_event_bridge_properties" map, not in the main
+ "cayenne.properties".</td>
+ <td></td>
+ <td></td>
+ </tr></tbody></table><p>
+ </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="current-limitations.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="client-configuration-properties.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 18. Current Limitations </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Appendix B. Service Collections</td></tr></table></div></body></html>
\ No newline at end of file
Modified: cayenne/site/cms/trunk/content/docs/3.1/cayenne-guide/setup.html
URL: http://svn.apache.org/viewvc/cayenne/site/cms/trunk/content/docs/3.1/cayenne-guide/setup.html?rev=1425994&r1=1425993&r2=1425994&view=diff
==============================================================================
--- cayenne/site/cms/trunk/content/docs/3.1/cayenne-guide/setup.html (original)
+++ cayenne/site/cms/trunk/content/docs/3.1/cayenne-guide/setup.html Wed Dec 26 19:20:15 2012
@@ -1,33 +1,33 @@
<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="Cayenne Guide"><link rel="up" href="cayenne-guide-part1.html" title="Part I. Object Relational Mapping with Cayenne"><link rel="prev" href="cayenne-guide-part1.html" title="Part I. Object Relational Mapping with Cayenne"><link rel="next" href="cayenne-mapping-structure.html" title="Chapter 2. Cayenne Mapping Structure"></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="cayenne-guide-part1.html">Prev</a> </td><th width="60%" align="center">Part I. Object Relational Mapping with Cayenn
e</th><td width="20%" align="right"> <a accesskey="n" href="cayenne-mapping-structure.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="setup"></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="setup.html#system-requirements">System Requirements</a></span></dt><dt><span class="section"><a href="setup.html#running-cayennemodeler">Running CayenneModeler</a></span></dt></dl></div><div class="section" title="System Requirements"><div class="titlepage"><div><div><h2 class="title"><a name="system-requirements"></a>System Requirements</h2></div></div></div><p>
- </p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p><span class="italic">Java</span>: Cayenne runtime framework and
- CayenneModeler GUI tool are written in 100% Java, and run on any
- Java-compatible platform. Required JDK version is 1.5 or higher. The last
- version of Cayenne compatible with JDK 1.4 is 1.2.x/2.0.x and JDK 1.3 is 1.1.x</p></li></ul></div><p>
- </p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p><span class="italic">JDBC Driver:</span> An appropriate DB-specific
- JDBC driver is needed to access the database. It can be included in the
- application or used in web container DataSource configuration.</p></li></ul></div><p>
- </p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p><span class="italic">Third-party Libraries:</span> Cayenne runtime
- framework has a minimal set of required and a few more optional dependencies
- on third-party open source packages. See "Including Cayenne in a Project"
- chapter for details.</p></li></ul></div><p>
- </p></div><div class="section" title="Running CayenneModeler"><div class="titlepage"><div><div><h2 class="title"><a name="running-cayennemodeler"></a>Running CayenneModeler</h2></div></div></div><p>CayenneModeler GUI tool is intended to work with object relational mapping projects. While
- you can edit your XML by hand, it is rarely needed, as the Modeler is a pretty advanced
- tool included in Cayenne distribution. To obtain CayenneModeler, download Cayenne
- distribution archive from <a class="link" href="http://cayenne.apache.org/download.html" target="_top">http://cayenne.apache.org/download.html</a> matching the OS you are using. Of
- course Java needs to be installed on the machine where you are going to run the
- Modeler.</p><p>OS X distribution contains CayenneModeler.app at the root of the distribution disk
- image.</p><p>Windows distribution contains CayenneModeler.exe file in the <code class="code">bin</code>
- directory.</p><p>Cross-platform distribution (targeting Linux, but as the name implies, compatible with any
- OS) contains a runnable CayenneModeler.jar in the <code class="code">bin</code> directory. It can be
- executed either by double-clicking, or if the environment is not configured to execute
- jars, by running from command-line:</p><pre class="programlisting">java -jar CayenneModeler.jar</pre><p>The Modeler can also be started from Maven. While it may look like an exotic way to start a
- GUI application, it has its benefits - no need to download Cayenne distribution, the
- version of the Modeler always matches the version of the framework, the plugin can find
- mapping files in the project automatically. So is an attractive option to some
- developers. Maven option requires a declaration in the
- POM:</p><pre class="programlisting"><build>
+ </p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p><span class="italic">Java</span>: Cayenne runtime framework and
+ CayenneModeler GUI tool are written in 100% Java, and run on any
+ Java-compatible platform. Required JDK version is 1.5 or higher. The last
+ version of Cayenne compatible with JDK 1.4 is 1.2.x/2.0.x and JDK 1.3 is 1.1.x</p></li></ul></div><p>
+ </p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p><span class="italic">JDBC Driver:</span> An appropriate DB-specific
+ JDBC driver is needed to access the database. It can be included in the
+ application or used in web container DataSource configuration.</p></li></ul></div><p>
+ </p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p><span class="italic">Third-party Libraries:</span> Cayenne runtime
+ framework has a minimal set of required and a few more optional dependencies
+ on third-party open source packages. See "Including Cayenne in a Project"
+ chapter for details.</p></li></ul></div><p>
+ </p></div><div class="section" title="Running CayenneModeler"><div class="titlepage"><div><div><h2 class="title"><a name="running-cayennemodeler"></a>Running CayenneModeler</h2></div></div></div><p>CayenneModeler GUI tool is intended to work with object relational mapping projects. While
+ you can edit your XML by hand, it is rarely needed, as the Modeler is a pretty advanced
+ tool included in Cayenne distribution. To obtain CayenneModeler, download Cayenne
+ distribution archive from <a class="link" href="http://cayenne.apache.org/download.html" target="_top">http://cayenne.apache.org/download.html</a> matching the OS you are using. Of
+ course Java needs to be installed on the machine where you are going to run the
+ Modeler.</p><p>OS X distribution contains CayenneModeler.app at the root of the distribution disk
+ image.</p><p>Windows distribution contains CayenneModeler.exe file in the <code class="code">bin</code>
+ directory.</p><p>Cross-platform distribution (targeting Linux, but as the name implies, compatible with any
+ OS) contains a runnable CayenneModeler.jar in the <code class="code">bin</code> directory. It can be
+ executed either by double-clicking, or if the environment is not configured to execute
+ jars, by running from command-line:</p><pre class="programlisting">java -jar CayenneModeler.jar</pre><p>The Modeler can also be started from Maven. While it may look like an exotic way to start a
+ GUI application, it has its benefits - no need to download Cayenne distribution, the
+ version of the Modeler always matches the version of the framework, the plugin can find
+ mapping files in the project automatically. So is an attractive option to some
+ developers. Maven option requires a declaration in the
+ POM:</p><pre class="programlisting"><build>
<plugins>
<plugin>
<groupId>org.apache.cayenne.plugins</groupId>