[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ojb-dev
Subject:    cvs commit: db-ojb/xdocs tutorial3.xml
From:       brj () apache ! org
Date:       2004-03-28 11:05:18
Message-ID: 20040328110518.12328.qmail () minotaur ! apache ! org
[Download RAW message or body]

brj         2004/03/28 03:05:18

  Modified:    xdocs    tutorial3.xml
  Log:
  added some warnings about referential integrity
  
  Revision  Changes    Path
  1.33      +41 -32    db-ojb/xdocs/tutorial3.xml
  
  Index: tutorial3.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/xdocs/tutorial3.xml,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- tutorial3.xml	28 Mar 2004 02:31:56 -0000	1.32
  +++ tutorial3.xml	28 Mar 2004 11:05:16 -0000	1.33
  @@ -293,20 +293,20 @@
   <ul>
       <li>
           <b>none</b> On updating or inserting of the main object with \
                <code>PersistenceBroker.store(...)</code>,
  -        the referenced object was NOT updated by default.The reference will be not \
<i>inserted</i> or  +        the referenced object will NOT be updated by default.The \
                reference will not be <i>inserted</i> or
           <i>updated</i>, the link to the reference (foreign key value to the \
                reference) on the main object
  -        will be not assigned automatic. The user has to link the main object and \
                to store the reference before
  -        the main object.
  +        will not be assigned automatically. The user has to link the main object \
and to store the reference <i>before</i>  +        the main object to avoid violation \
of referential integrity.  </li>
       <li>
           <b>link</b> On updating or inserting of the main object with \
                <code>PersistenceBroker.store(...)</code>,
  -        the FK assignment on the main object was done automatic. OJB read the PK \
                from the reference object and set these
  -        values as FK in main object. But the referenced object was not touched. If \
                no reference object was found, the FK
  -        will be nullified. (On insert it is allowed to set the FK without populate \
the referenced object)  +        the FK assignment on the main object was done \
automatic. OJB reads the PK from the referenced object and sets these  +        \
values as FK in main object. But the referenced object remains untouched. If no \
referenced object is found, the FK  +        will be nullified. (On insert it is \
allowed to set the FK without populating the referenced object)  </li>
       <li>
           <b>object</b> On updating or inserting of the main object with \
                <code>PersistenceBroker.store(...)</code>,
  -        the reference object was stored first, then OJB does the same as in \
<i>link</i>.  +        the referenced object will be stored first, then OJB does the \
same as in <i>link</i>.  </li>
       <li>
           <b>false</b>
  @@ -324,8 +324,8 @@
   <ul>
       <li>
           <b>none</b>
  -        On deleting an object with <code>PersistenceBroker.delete(...)</code> the \
                referenced object was
  -        NOT touched.
  +        On deleting an object with <code>PersistenceBroker.delete(...)</code> the \
referenced object will  +        NOT be touched.
       </li>
       <li>
           <b>link</b>
  @@ -333,7 +333,7 @@
       </li>
       <li>
           <b>object</b>
  -        On deleting an object with <code>PersistenceBroker.delete(...)</code> the \
referenced object was  +        On deleting an object with \
<code>PersistenceBroker.delete(...)</code> the referenced object will be  deleted \
too.  </li>
       <li>
  @@ -580,18 +580,20 @@
   <ul>
       <li>
           <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 be not <i>inserted</i> or  +        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)
  -        automatic. The user has to link and to store the referenced objects after \
storing the main object.  +        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>
       <li>
           <b>link</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 be not <i>inserted</i> or
  -        <i>updated</i>, but the referenced objects will be linked automatic (FK \
assignment).  +        the referenced objects are NOT updated by default. The \
referenced objects will not be <i>inserted</i> or  +        <i>updated</i>, but the \
referenced objects will be linked automatically (FK assignment) the main object.  \
</li>  <li>
           <b>object</b> On updating or inserting of the main object with \
                <code>PersistenceBroker.store(...)</code>,
  -        the referenced objects will be linked and stored automatic.
  +        the referenced objects will be linked and stored automatically.
       </li>
       <li>
           <b>false</b>
  @@ -609,7 +611,8 @@
       <li>
           <b>none</b>
           On deleting an object with <code>PersistenceBroker.delete(...)</code> the \
                referenced objects are
  -        NOT touched.
  +        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>
           <b>link</b>
  @@ -940,20 +943,23 @@
   <ul>
       <li>
           <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 be not <i>inserted</i> or  +        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 (creation of FK \
                entries in the indirection table)
  -        automatic. The user has to store the main object, the referenced objects \
                and to link the
  -        m:n relation after storing of all objects.
  +        automatically. The user has to store the main object, the referenced \
objects and to link the  +        m:n relation after storing of all objects. \
establishing the m:n relationship <i>before</i>  +        storing main and referenced \
objects may violate referential integrity.  </li>
       <li>
           <b>link</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 be not <i>inserted</i> or
  -        <i>updated</i>, but the m:n relation was linked automatic (creation of FK \
                entries in the indirection table).
  -        <br/>NOTE: Make sure that the referenced objects exist in database before \
store main object.  +        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   +        to avoid violation of referential integrity.
       </li>
       <li>
           <b>object</b> On updating or inserting of the main object with \
                <code>PersistenceBroker.store(...)</code>,
  -        the referenced objects will be linked and stored automatic.
  +        the referenced objects will be linked and stored automatically.
       </li>
       <li>
           <b>false</b>
  @@ -971,7 +977,8 @@
       <li>
           <b>none</b>
           On deleting an object with <code>PersistenceBroker.delete(...)</code> the \
                referenced objects are
  -        NOT touched.
  +        NOT touched. The corresponding entries of the main object in the \
indirection table will not be removed.  +        This may lead to violation of \
referential integrity depending on the definition of the indirection table.  </li>
       <li>
           <b>link</b>
  @@ -1099,18 +1106,20 @@
   <subsection name="Link references">
   <p>
       <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 do not touch the \
                referenced objects on insert,
  -    update or delete operations of the main object. The user has to take care of \
                correct handling of
  -    referenced objects.
  +    <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. 
  +    When using referential integrity (who does not ?) it's essential that insert \
and delete operations are done  +    in the correct sequence.
       </p>
       <p>
       One important thing is assignment of the FK values. The assign of the FK \
                values is transcribed with
       <b><i>link references</i></b> in OJB. In 1:1 references the main object has a \
                FK to the referenced object, in 1:n
  -    references the referenced objects has a FK to the main object and in \
                non-decomposed m:n relations
  -    a indirection table with FK values from both sides was used.
  +    references the referenced objects have FK pointing to the main object and in \
non-decomposed m:n relations  +    a indirection table containing FK values from both \
sides of the relationship is used.  </p>
       <p>
  -    OJB provide some helper methods for manual reference linking (assignment of \
the FK) in  +    OJB provides some helper methods for linking references manually \
(assignment of the FK) in  <code>org.apache.ojb.broker.util.BrokerHelper</code> \
class.  <source>
       public void link(Object obj, boolean insert)
  @@ -1124,7 +1133,7 @@
   </source>
       <p>
           <b>NOTE:</b> The <i>link/unlink</i> methods are only useful if you set \
                auto-update/-delete to <i>none</i>. In
  -        all other cases OJB handle the link/unlink of references internally. It is \
also possible to set all FK values by  +        all other cases OJB handles the \
link/unlink of references internally. It is also possible to set all FK values by  \
hand without using the link/unlink service methods.  </p>
       <p>
  
  
  

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic