db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb/broker/sequence NativeIdentifierTest.java
Date Thu, 29 Jul 2004 07:24:51 GMT
arminw      2004/07/29 00:24:51

  Modified:    src/test/org/apache/ojb/broker/sequence Tag: OJB_1_0_RELEASE
                        NativeIdentifierTest.java
  Log:
  comment workaround
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.10.2.2  +29 -7     db-ojb/src/test/org/apache/ojb/broker/sequence/NativeIdentifierTest.java
  
  Index: NativeIdentifierTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/sequence/NativeIdentifierTest.java,v
  retrieving revision 1.10.2.1
  retrieving revision 1.10.2.2
  diff -u -r1.10.2.1 -r1.10.2.2
  --- NativeIdentifierTest.java	29 Jul 2004 06:34:43 -0000	1.10.2.1
  +++ NativeIdentifierTest.java	29 Jul 2004 07:24:50 -0000	1.10.2.2
  @@ -3,6 +3,7 @@
   import java.io.Serializable;
   import java.sql.Connection;
   import java.sql.Statement;
  +import java.sql.SQLException;
   import java.util.ArrayList;
   import java.util.Collection;
   import java.util.Iterator;
  @@ -26,6 +27,7 @@
   import org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl;
   import org.apache.ojb.junit.PBTestCase;
   import org.apache.ojb.odmg.OJB;
  +import org.apache.ojb.odmg.TransactionExt;
   import org.odmg.Database;
   import org.odmg.Implementation;
   import org.odmg.Transaction;
  @@ -96,11 +98,23 @@
           {
               con = pb.serviceConnectionManager().getConnection();
               stmt = con.createStatement();
  -            stmt.execute(DROP);
  +            try
  +            {
  +                stmt.execute(DROP);
  +            }
  +            catch (SQLException e)
  +            {
  +            }
               stmt.close();
   
               stmt = con.createStatement();
  -            stmt.execute(DROP_REF);
  +            try
  +            {
  +                stmt.execute(DROP_REF);
  +            }
  +            catch (SQLException e)
  +            {
  +            }
               stmt.close();
           }
           finally
  @@ -540,6 +554,14 @@
   
           Transaction tx = odmg.newTransaction();
           tx.begin();
  +//        // workaround
  +//        PersistenceBroker pb = ((TransactionExt) tx).getBroker();
  +//        if(!pb.isInTransaction())pb.beginTransaction();
  +//        pb.store(s_ref_1);
  +//        pb.store(s_ref_2);
  +//        pb.store(s_ref_3);
  +//        pb.store(s_ref_4);
  +//        // workaround end
           //db.makePersistent(ref_1);
           db.makePersistent(obj_1);
           db.makePersistent(obj_2);
  @@ -618,12 +640,12 @@
           // add new reference to object
           CollectionReference ref_5 = new CollectionReference(null, nameRef);
           CollectionReference ref_6 = new CollectionReference(null, nameRef);
  +        tx.begin();
  +        tx.lock(obj_1, Transaction.WRITE);
  +        tx.lock(obj_2, Transaction.WRITE);
           obj_1.addReference(ref_5);
           obj_2.addReference(ref_6);
  -        broker.beginTransaction();
  -        broker.store(obj_1);
  -        broker.store(obj_2);
  -        broker.commitTransaction();
  +        tx.commit();
           assertNotNull(ref_5.getRefIdentifier());
           assertNotNull(ref_6.getRefIdentifier());
           assertEquals(id_1, obj_1.getIdentifier());
  
  
  

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


Mime
View raw message