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/09/08 11:25:28 UTC

svn commit: r1382267 - /cayenne/main/branches/STABLE-3.1/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml

Author: aadamchik
Date: Sat Sep  8 09:25:28 2012
New Revision: 1382267

URL: http://svn.apache.org/viewvc?rev=1382267&view=rev
Log:
docs

ObjectContext docs - local object

(cherry picked from commit ea74a0d3284bddc88286c80b5320f62c89a6eef6)

Modified:
    cayenne/main/branches/STABLE-3.1/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml

Modified: cayenne/main/branches/STABLE-3.1/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.1/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml?rev=1382267&r1=1382266&r2=1382267&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.1/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml (original)
+++ cayenne/main/branches/STABLE-3.1/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml Sat Sep  8 09:25:28 2012
@@ -137,6 +137,14 @@ context.deleteObjects(artist2, artist3, 
 			update, delete operations are sent to the database only when "commitChanges" is called.
 			Similarly "rollbackChanges" will undo the effect of "newObject" and
 			"deleteObjects".</para>
+		<para><emphasis>localObject</emphasis> returns a copy of a given persistent object that is
+			"local" to a given ObjectContext:</para>
+		<para>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:<programlisting>ObjectContext editingContext = runtime.getContext();
+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
 			ObjectContext:<programlisting>EntityResolver resolver = objectContext.getEntityResolver();</programlisting></para>