db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r432275 - /db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/guides/sequencemanager.xml
Date Thu, 17 Aug 2006 16:14:59 GMT
Author: arminw
Date: Thu Aug 17 09:14:58 2006
New Revision: 432275

URL: http://svn.apache.org/viewvc?rev=432275&view=rev
fix OJB-96


Modified: db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/guides/sequencemanager.xml
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/guides/sequencemanager.xml?rev=432275&r1=432274&r2=432275&view=diff
--- db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/guides/sequencemanager.xml
+++ db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/guides/sequencemanager.xml
Thu Aug 17 09:14:58 2006
@@ -97,10 +97,10 @@
                     <title>since OJB 1.0.4</title>
-                        OJB no longer assign the PK values of transient objects on creation
-                        the <a href="ext:identity"><code>Identity</code></a>
objects (using
+                        OJB no longer assign the PK values of <strong>transient objects</strong>
on creation of
+                        <a href="ext:identity"><code>Identity</code></a>
objects (using
                         <a href="ext:identity-factory"><code>IdentityFactory</code></a>).
-                        The <code>Identity</code> object of a transient persistence
capable object
+                        The <code>Identity</code> object of a <em>transient
persistence capable object</em>
                         is completely independent of the "real" primary key assigned on insert
                         of the object - when calling
@@ -108,7 +108,7 @@
 Identity oid = broker.serviceIdentity().buildIdentity(object);]]></source>
                         the specified persistence capable object will not be modified and
-                        returned <code>Identity</code> object use transient primary
key placeholder.
+                        returned <code>Identity</code> object use <em>transient
primary key placeholders</em>.
                         The reason for doing this was to "harmonize" the behavior of OJB
@@ -118,9 +118,23 @@
                         it's not possible to lookup the generated PK value before
                         the object is written to database.
-                    <p>
-                    </p>
+                    <anchor id="forceBackward"/>
+                    <section>
+                        <title>Backward compatibility: Force the assignment of PK fields
while Identity creation</title>
+                        <p>
+                            To be backward compatible with older versions of OJB it's still
possible to force the
+                            assignment of PK fields while Identity creation before the object
was made persistent,
+                            using the an specific Identity constructor (instead of the
+                            <code>IdentityFactory</code> described in above sections).
+                        </p>
+                        <source><![CDATA[
+Identity oid = new Identity(object, broker);]]></source>
+                        <note>
+                            But it's strongly recommended to avoid these calls to avoid the
drawbacks described above.
+                            This call will be illegal in future versions of OJB.
+                        </note>
+                    </section>
                 <anchor id="before-1.0.4"/>
@@ -130,25 +144,28 @@
                     By default OJB triggers the computation
                     of unique ids during calls to PersistenceBroker.store(...).
                     Sometimes it will be necessary to have the ids computed in advance,
-                    before a new persistent object was written to database.
+                    <strong>before</strong> a new persistent object was written
to database.
                     This can be done by simply obtaining the Identity of the respective object
-Identity oid = broker.serviceIdentity().buildIdentity(object);]]></source>
+Identity oid = broker.serviceIdentity().buildIdentity(object);
+Identity oid = new Identity(object, broker);]]></source>
                     This creates an <a href="ext:api/identity"><code>Identity</code></a>
object for the
-                    new persistent object and set all primary key values of the new persistent
-                    - But it only works if <a href="#autoincrement"><code>autoincrement</code></a>
+                    transient object and set all primary key values. But this only works
+                    <a href="#autoincrement"><code>autoincrement</code></a>
                     is enabled for the primary key fields.
                     Force computation of unique values is not allowed when using <em>database
                     Identity columns</em> for primary key generation (e.g via
                     <a href="#identity-columns">Identity column supporting sequence
manager</a>), because the
-                    <em>real</em> PK value is at the earliest available after
database insert operation. If you
-                    nevertheless force PK computing, OJB will use an temporary dummy PK value
in the
-                    Identity object and this may lead to unexpeted behavior.
+                    <em>real</em> PK value is at the earliest available after
database insert operation
+                    (never for transient objects). If you
+                    nevertheless force PK computing, OJB will use temporary dummy PK values
in the
+                    transient object and created Identity instance - this may lead to unexpeted
                     Info about lookup persistent objects by primary key fields

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

View raw message