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 2006/01/17 00:56:27 UTC

svn commit: r369603 - /db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/CircularTest.java

Author: arminw
Date: Mon Jan 16 15:56:23 2006
New Revision: 369603

URL: http://svn.apache.org/viewcvs?rev=369603&view=rev
Log:
fix tests

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/CircularTest.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/CircularTest.java
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/CircularTest.java?rev=369603&r1=369602&r2=369603&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/CircularTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/CircularTest.java Mon Jan 16 15:56:23 2006
@@ -418,11 +418,15 @@
 
         TransactionExt tx = (TransactionExt) odmg.newTransaction();
         tx.begin();
+        database.makePersistent(sd);
+        tx.flush();
         database.makePersistent(s1);
         tx.commit();
 
         tx.begin();
         database.deletePersistent(s1);
+        tx.flush();
+        database.deletePersistent(sd);
         tx.commit();
     }
 
@@ -467,13 +471,13 @@
     public void testBidirectionalWithConstraint_1c() throws Exception
     {
         String name = "testBidirectionalWithConstraint_1c_" + System.currentTimeMillis();
-        TransactionExt tx = (TransactionExt) odmg.newTransaction();
 
         Shop s1 = new Shop(name + "_1");
         ShopDetail sd = new ShopDetail(name + "_1");
         s1.setDetail(sd);
         sd.setShop(s1);
 
+        TransactionExt tx = (TransactionExt) odmg.newTransaction();
         // set implicit locking false to determine order of objects
         tx.setImplicitLocking(false);
         // to prevent reordering of object, disable ordering
@@ -485,6 +489,9 @@
         // will be created and then the Shop
         database.makePersistent(sd);
         database.makePersistent(s1);
+        // now write objects to database
+        tx.flush();
+        // this call will now detect the changed FK values of the bidirectional 1:1 reference
         tx.commit();
 
         // we using the same tx, thus locking and (ordering) is still disabled
@@ -518,6 +525,8 @@
         // only for testing, we completely bypass odmg
         tx.getBroker().beginTransaction();
         tx.getBroker().store(s1);
+        // we need this call to assign the Shop FK in ShopDetail
+        tx.getBroker().store(sd);
         tx.commit();
 
 



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