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/java/org/apache/ojb/odmg ObjectEnvelope.java ObjectEnvelopeTable.java
Date Sun, 03 Apr 2005 11:25:19 GMT
arminw      2005/04/03 04:25:19

  Modified:    src/java/org/apache/ojb/odmg Tag: OJB_1_0_RELEASE
                        ObjectEnvelope.java ObjectEnvelopeTable.java
  Log:
  fix bug in handling m:n relation. m:n indirection entry was added to 1:n link list
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.32.2.11 +6 -2      db-ojb/src/java/org/apache/ojb/odmg/ObjectEnvelope.java
  
  Index: ObjectEnvelope.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/ObjectEnvelope.java,v
  retrieving revision 1.32.2.10
  retrieving revision 1.32.2.11
  diff -u -r1.32.2.10 -r1.32.2.11
  --- ObjectEnvelope.java	22 Mar 2005 17:08:37 -0000	1.32.2.10
  +++ ObjectEnvelope.java	3 Apr 2005 11:25:19 -0000	1.32.2.11
  @@ -714,12 +714,15 @@
                   {
                       buffer.addM2NLinkEntry(cds, getObject(), newObj);
                   }
  +                else
  +                {
  +                    // we have to link the new object
  +                    mod.addLinkOneToN(cds, getObject(), false);
  +                }
                   if(mod.needsInsert())
                   {
                       buffer.addForInsertDependent(mod);
                   }
  -                // we have to link the new object
  -                mod.addLinkOneToN(cds, getObject(), false);
               }
           }
       }
  @@ -770,6 +773,7 @@
   
       void addLinkOneToN(CollectionDescriptor col, Object source, boolean unlink)
       {
  +        if(col.isMtoNRelation()) throw new OJBRuntimeException("Expected an 1:n relation,
but specified a m:n");
           LinkEntry entry = new LinkEntryOneToN(source, col, getObject(), unlink);
           linkEntryList.add(entry);
           //setModificationState(getModificationState().markDirty());
  
  
  
  1.32.2.17 +13 -4     db-ojb/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java
  
  Index: ObjectEnvelopeTable.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java,v
  retrieving revision 1.32.2.16
  retrieving revision 1.32.2.17
  diff -u -r1.32.2.16 -r1.32.2.17
  --- ObjectEnvelopeTable.java	3 Apr 2005 02:38:45 -0000	1.32.2.16
  +++ ObjectEnvelopeTable.java	3 Apr 2005 11:25:19 -0000	1.32.2.17
  @@ -27,6 +27,7 @@
   import org.apache.ojb.broker.Identity;
   import org.apache.ojb.broker.OptimisticLockException;
   import org.apache.ojb.broker.PersistenceBroker;
  +import org.apache.ojb.broker.OJBRuntimeException;
   import org.apache.ojb.broker.accesslayer.ConnectionManagerIF;
   import org.apache.ojb.broker.core.proxy.CollectionProxy;
   import org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl;
  @@ -173,6 +174,12 @@
   
               // 4. Reorder objects
               reorder();
  +//            System.out.println("## ordering: ");
  +//            for(int i = 0; i < mvOrderOfIds.size(); i++)
  +//            {
  +//                System.out.println("" + mvOrderOfIds.get(i));
  +//            }
  +//            System.out.println("## ordering end");
   
               // 5. write objects.
               writeAllEnvelopes(needsReusePrepare);
  @@ -781,9 +788,10 @@
           }
       }
   
  -    void addM2NLinkEntry(CollectionDescriptor cld, Object leftSource, Object rightSource)
  +    void addM2NLinkEntry(CollectionDescriptor cod, Object leftSource, Object rightSource)
       {
  -        m2nLinkList.add(new LinkEntryMtoN(leftSource, cld, rightSource, false));
  +        if(!cod.isMtoNRelation()) throw new OJBRuntimeException("Expect a m:n releation,
but specified a 1:n");
  +        m2nLinkList.add(new LinkEntryMtoN(leftSource, cod, rightSource, false));
       }
   
       void performM2NLinkEntries()
  @@ -797,9 +805,10 @@
           }
       }
   
  -    void addM2NUnlinkEntry(CollectionDescriptor cld, Object leftSource, Object rightSource)
  +    void addM2NUnlinkEntry(CollectionDescriptor cod, Object leftSource, Object rightSource)
       {
  -        m2nUnlinkList.add(new LinkEntryMtoN(leftSource, cld, rightSource, true));
  +        if(!cod.isMtoNRelation()) throw new OJBRuntimeException("Expect a m:n releation,
but specified a 1:n");
  +        m2nUnlinkList.add(new LinkEntryMtoN(leftSource, cod, rightSource, true));
       }
   
       void performM2NUnlinkEntries()
  
  
  

---------------------------------------------------------------------
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