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 2013/05/26 22:32:27 UTC
svn commit: r1486470 - in /cayenne/main/trunk/docs/docbook:
cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml
getting-started/src/docbkx/object-context.xml
Author: aadamchik
Date: Sun May 26 20:32:27 2013
New Revision: 1486470
URL: http://svn.apache.org/r1486470
Log:
CAY-1831 CayenneRuntime.getContext - replace with newContext
docs update
Modified:
cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml
cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/object-context.xml
Modified: cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml?rev=1486470&r1=1486469&r2=1486470&view=diff
==============================================================================
--- cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml (original)
+++ cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml Sun May 26 20:32:27 2013
@@ -7,7 +7,7 @@
<para>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:<programlisting language="java">ObjectContext context = runtime.getContext();</programlisting></para>
+ ServerRuntime:<programlisting language="java">ObjectContext context = runtime.newContext();</programlisting></para>
<para>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
@@ -143,7 +143,7 @@ context.deleteObjects(artist2, artist3,
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:<programlisting language="java">ObjectContext editingContext = runtime.getContext();
+ them:<programlisting language="java">ObjectContext editingContext = runtime.newContext();
Artist localArtist = editingContext.localObject(artist);</programlisting></para>
<para>Often an appliction needs to inspect mapping metadata. This information is stored in
the EntityResolver object, accessible via the
@@ -185,8 +185,8 @@ Artist localArtist = editingContext.loca
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.</para>
<para>To create a nested context, use an instance of ServerRuntime, passing it the desired
- parent:<programlisting language="java">ObjectContext parent = runtime.getContext();
-ObjectContext nested = runtime.getContext((DataChannel) parent);</programlisting>From
+ parent:<programlisting language="java">ObjectContext parent = runtime.newContext();
+ObjectContext nested = runtime.newContext((DataChannel) parent);</programlisting>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
Modified: 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=1486470&r1=1486469&r2=1486470&view=diff
==============================================================================
--- cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/object-context.xml (original)
+++ cayenne/main/trunk/docs/docbook/getting-started/src/docbkx/object-context.xml Sun May 26 20:32:27 2013
@@ -37,7 +37,7 @@ public class Main {
public static void main(String[] args) {
ServerRuntime cayenneRuntime = new ServerRuntime(
"cayenne-project.xml");
- ObjectContext context = cayenneRuntime.getContext();
+ ObjectContext context = cayenneRuntime.newContext();
}
}</programlisting></para>
<para>ObjectContext is an isolated "session" in Cayenne that provides all needed API