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/04/05 19:21:24 UTC

cvs commit: db-ojb/xdocs tutorial3.xml

arminw      2004/04/05 10:21:24

  Modified:    xdocs    tutorial3.xml
  Log:
  - add note in m:n relation section NOT to use a removal aware collection
  
  Revision  Changes    Path
  1.35      +23 -5     db-ojb/xdocs/tutorial3.xml
  
  Index: tutorial3.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/xdocs/tutorial3.xml,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- tutorial3.xml	5 Apr 2004 13:59:01 -0000	1.34
  +++ tutorial3.xml	5 Apr 2004 17:21:24 -0000	1.35
  @@ -598,7 +598,7 @@
           <b>none</b> On updating or inserting of the main object with <code>PersistenceBroker.store(...)</code>,
           the referenced objects are NOT updated by default. The referenced objects will not be <i>inserted</i> or
           <i>updated</i>, the referenced objects will not be linked (foreign key assignment on referenced objects)
  -        to the main object automatically. 
  +        to the main object automatically.
           The user has to link and to store the referenced objects <i>after</i> storing the main object
           to avoid violation of referential integrity.
       </li>
  @@ -627,7 +627,7 @@
       <li>
           <b>none</b>
           On deleting an object with <code>PersistenceBroker.delete(...)</code> the referenced objects are
  -        NOT touched. This may lead to violation of referential integrity if the referenced objects 
  +        NOT touched. This may lead to violation of referential integrity if the referenced objects
           are childs of the main object. In this case the referenced objects have to be deleted manually first.
       </li>
       <li>
  @@ -863,6 +863,24 @@
   table:
   </p>
   
  +    <p>
  +        <strong>NOTE:</strong> OJB supports a multiplicity of collection implementations,
  +        inter alia <code>org.apache.ojb.broker.util.collections.RemovalAwareCollection</code>
  +        and <code>org.apache.ojb.broker.util.collections.RemovalAwareList</code>. By default the
  +        removal aware collection was used. This cause problems in m:n relations when
  +        <code>auto-update="true"</code> and <code>auto-delete="false"</code> is set, because objects
  +        deleted in the collection will be deleted on update of main object. Thus it is recommended to
  +        use a NOT removal aware collection class in m:n relations by setting e.g.
  +    </p>
  +    <source>
  +collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
  +    </source>
  +    <p>
  +        in the collection-descriptor.
  +    </p>
  +    <p>
  +        An example for a m:n relation looks like:
  +    </p>
   <source><![CDATA[
   <class-descriptor
     class="org.apache.ojb.broker.Person"
  @@ -970,7 +988,7 @@
           the referenced objects are NOT updated by default. The referenced objects will not be <i>inserted</i> or
           <i>updated</i>, but the m:n relation will be linked automatically (creation of FK entries in the indirection table).
           <br/>
  -        NOTE: Make sure that the referenced objects exist in database before storing the main object 
  +        NOTE: Make sure that the referenced objects exist in database before storing the main object
           to avoid violation of referential integrity.
       </li>
       <li>
  @@ -1124,7 +1142,7 @@
       <p>If in <code>reference-descriptor</code> or <code>collection-descriptor</code> the <i>auto-update</i> or
       <i>auto-delete</i> attributes are set to <i>none</i>, OJB does not touch the referenced objects on insert,
       update or delete operations of the main object. The user has to take care of the correct handling of
  -    referenced objects. 
  +    referenced objects.
       When using referential integrity (who does not ?) it's essential that insert and delete operations are done
       in the correct sequence.
       </p>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org