You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2004/07/07 15:14:21 UTC
cvs commit: db-ojb/src/doc/forrest/src/documentation/content/xdocs site.xml
arminw 2004/07/07 06:14:21
Modified: src/doc/forrest/src/documentation/content/xdocs/docu/tutorials
pb-tutorial.xml
src/doc/forrest/src/documentation/content/xdocs/docu faq.xml
src/doc/forrest/src/documentation/content/xdocs site.xml
Log:
add new section about 'get object by PK'
add new FAQ
Revision Changes Path
1.2 +28 -2 db-ojb/src/doc/forrest/src/documentation/content/xdocs/docu/tutorials/pb-tutorial.xml
Index: pb-tutorial.xml
===================================================================
RCS file: /home/cvs/db-ojb/src/doc/forrest/src/documentation/content/xdocs/docu/tutorials/pb-tutorial.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- pb-tutorial.xml 20 Jun 2004 09:12:33 -0000 1.1
+++ pb-tutorial.xml 7 Jul 2004 13:14:21 -0000 1.2
@@ -204,11 +204,13 @@
</section>
+ <anchor id="query-objects"/>
<section>
<title>Querying Persistent Objects</title>
<p>
Once objects have been stored to the database, it is important to be able to get them
- back. The PersistenceBroker API provides two mechanisms for building queries, by
+ back. The PersistenceBroker API provides two mechanisms for
+ <link href="site:query">building queries</link>, by
using a template object, or by using specific criteria.
</p>
<source><![CDATA[
@@ -419,6 +421,30 @@
This method simply deletes an object from the database.
</p>
</section>
+
+ <anchor id="find-by-pk"/>
+ <section>
+ <title>Find object by primary key</title>
+ <p>
+ In some cases only the primary key values (single field or n-fields for composed primary
+ keys) of an object are known. In OJB you have several ways to request the whole object.
+ It is possible to build a query as
+ <link href="#query-objects">shown above</link>, but the smarter
+ solution is to use <code>PersistenceBroker#getObjectByIdentity(Identity oid)</code>. An
+ <link href="ext:identity">Identity</link> object is a unique representation of a persistence
+ capable object based on the object primary key values and the <em>top-level class</em> (abstract class,
+ interface or the class itself, depending on the
+ <link href="site:advanced-technique/extents">extent metadata mapping</link>).
+ </p>
+ <p>
+ For example, to find an <em>Product</em> with an single primary key of <em>'23'</em>
+ do
+ </p>
+ <source><![CDATA[
+Identity oid = broker.serviceIdentity().buildIdentity(Product.class, new Integer(23));
+Product product = (Product) broker.getObjectByIdentity(oid);]]></source>
+ </section>
+
</section>
1.3 +12 -1 db-ojb/src/doc/forrest/src/documentation/content/xdocs/docu/faq.xml
Index: faq.xml
===================================================================
RCS file: /home/cvs/db-ojb/src/doc/forrest/src/documentation/content/xdocs/docu/faq.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- faq.xml 30 Jun 2004 15:36:50 -0000 1.2
+++ faq.xml 7 Jul 2004 13:14:21 -0000 1.3
@@ -848,6 +848,17 @@
</faq>
+ <faq id="lookupByPK">
+ <question>
+ How to lookup object by primary key?
+ </question>
+ <answer>
+ <p>
+ Please see <link href="site:pb-tutorial/find-by-pk">PB tutorial section</link>.
+ </p>
+ </answer>
+ </faq>
+
<faq id="itOrCol">
<question>
1.6 +6 -2 db-ojb/src/doc/forrest/src/documentation/content/xdocs/site.xml
Index: site.xml
===================================================================
RCS file: /home/cvs/db-ojb/src/doc/forrest/src/documentation/content/xdocs/site.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- site.xml 30 Jun 2004 21:57:11 -0000 1.5
+++ site.xml 7 Jul 2004 13:14:21 -0000 1.6
@@ -82,7 +82,9 @@
<mapping-tutorial label="Mapping Tutorial" href="mapping-tutorial.html" description="Mapping tutorial">
<metadata-mapping href="#metadata"/>
</mapping-tutorial>
- <pb-tutorial label="The PB API" href="pb-tutorial.html" description="PB tutorial"/>
+ <pb-tutorial label="The PB API" href="pb-tutorial.html" description="PB tutorial">
+ <find-by-pk href="#find-by-pk"/>
+ </pb-tutorial>
<odmg-tutorial label="The ODMG API" href="odmg-tutorial.html" description="odmg tutorial"/>
<jdo-tutorial label="The JDO API" href="jdo-tutorial.html" description="jdo tutorial"/>
<otm-tutorial label="The OTM API" href="otm-tutorial.html" description="otm tutorial"/>
@@ -200,6 +202,8 @@
<perf-test href="org/apache/ojb/performance/PerfTest.html"/>
<perf-handle href="org/apache/ojb/performance/PerfHandle.html"/>
<perf-article href="org/apache/ojb/performance/PerfArticle.html"/>
+ <identity href="org/apache/ojb/broker/Identity.html"/>
+ <identity-factory href="org/apache/ojb/broker/IdentityFactory.html"/>
</api>
<ojb>
<wiki-page href="http://wiki.apache.org/db-ojb"/>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org