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 th...@apache.org on 2003/12/13 22:48:27 UTC
cvs commit: db-ojb/xdocs tutorial3.xml
thma 2003/12/13 13:48:27
Modified: xdocs tutorial3.xml
Log:
provide more explanation for the auto-* flags
Revision Changes Path
1.31 +51 -7 db-ojb/xdocs/tutorial3.xml
Index: tutorial3.xml
===================================================================
RCS file: /home/cvs/db-ojb/xdocs/tutorial3.xml,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- tutorial3.xml 27 Oct 2003 18:17:05 -0000 1.30
+++ tutorial3.xml 13 Dec 2003 21:48:27 -0000 1.31
@@ -748,32 +748,76 @@
specified default values are assumed:</p>
<OL>
<LI>
- On materializing an Object from the RDBMS with
- <code>PersistenceBroker.getObjectByQuery(...)</code>all
- its referenced objects (both 1:1 and 1:n associations) are
+ <b><code>auto-retrieve="true"</code></b><br/>
+ By default materializing an Object from the RDBMS with
+ <code>PersistenceBroker.getObjectByQuery(...)</code> cause all
+ its referenced objects (both 1:1 and 1:n associations) to be
materialized as well.
(If OJB is configured to use proxies, the referenced objects are
not materialized immmediately, but lazy loading proxy objects are used
instead.)
</LI>
<LI>
+ <b><code>auto-update="false"</code></b><br/>
On updating or inserting an object with
<code>PersistenceBroker.store(...)
- </code>referenced objects are NOT updated by default.
+ </code>referenced objects are NOT updated by default.
</LI>
<LI>
+ <b><code>auto-delete="false"</code></b><br/>
On deleting an object with <code>PersistenceBroker.delete(...)
</code>referenced objects are NOT deleted by default.
</LI>
</OL>
<p>
- If these default values are to be used, no special settings have to be
- made in the reference-descriptor or collection-descriptor elements.
+ If no special settings are
+ made in the reference-descriptor or collection-descriptor elements,
+ these default settings are used.
</p>
<p>
<b>These default settings are mandatory for proper operation of the ODMG
and JDO implementation.</b>
</p>
+
+<p>
+ The default settings can be changed as follows:
+ <OL>
+ <LI>
+ <b><code>auto-retrieve="false"</code></b><br/>
+ With this setting references and and Collection attributes
+ will not be loaded by OJB on loading instances.
+ OJB will also not replace those attributes with dynamic proxies.
+ These attributes simply stay set to <code>null</code>.
+ If such attributes must be accessed later, the user is responsible
+ to load them manually with the
+ <code>PersistenceBroker.retrieveReference(...)</code>
+ <code>PersistenceBroker.retrieveAllReferences(...)</code> methods.
+ </LI>
+ <LI>
+ <b><code>auto-update="true"</code></b><br/>
+ If this flag is set on a reference- or collection-attribute
+ the referenced objects are also persisted (inserted or updated) to the database.
+ Objects that have been removed from collections are not automatically
+ handled by the PersistenceBroker.
+ By using special collections like the RemovalAwareCollection you can
+ achieve automatic handling of deletion from collections.
+ </LI>
+ <LI>
+ <b><code>auto-delete="true"</code></b><br/>
+ If this flag is set on a reference- or collection-attribute
+ the referenced objects are also deleted if an instance of
+ the persistent class is deleted.
+ The PersistenceBroker does <b>not</b> provide a full cascading delete,
+ but does only remove objects that are actually referenced.
+ Assume you load a master object that has a collection of 5 detail items
+ and remove 2 of them. If the master object is deleted only the three
+ remaining detail items are deleted. As the other two detail items
+ are not deleted, this could result in foreign key violations
+ if handled carelessly.
+ </LI>
+ </OL>
+</p>
+
<p>
In the following code sample, a reference-descriptor and a collection-descriptor
are configured to use cascading retrieval (<code>auto-retrieve="true"</code>),
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org