db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/core PersistenceBrokerImpl.java
Date Thu, 06 Nov 2003 21:42:18 GMT
brj         2003/11/06 13:42:18

  Modified:    src/java/org/apache/ojb/broker/core
                        PersistenceBrokerImpl.java
  Log:
  use empty mn-list on insert (by Andy Malakov)
  
  Revision  Changes    Path
  1.47      +18 -10    db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
  
  Index: PersistenceBrokerImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- PersistenceBrokerImpl.java	5 Nov 2003 20:33:10 -0000	1.46
  +++ PersistenceBrokerImpl.java	6 Nov 2003 21:42:18 -0000	1.47
  @@ -55,11 +55,13 @@
    */
   
   import java.lang.reflect.Array;
  +import java.lang.reflect.Proxy;
   import java.util.ArrayList;
   import java.util.Collection;
  +import java.util.Collections;
   import java.util.Enumeration;
  -import java.util.Iterator;
   import java.util.HashMap;
  +import java.util.Iterator;
   import java.util.List;
   import java.util.Map;
   import java.util.Vector;
  @@ -68,8 +70,8 @@
   import org.apache.ojb.broker.accesslayer.*;
   import org.apache.ojb.broker.accesslayer.sql.SqlGenerator;
   import org.apache.ojb.broker.accesslayer.sql.SqlGeneratorFactory;
  -import org.apache.ojb.broker.cache.ObjectCacheFactory;
   import org.apache.ojb.broker.cache.ObjectCache;
  +import org.apache.ojb.broker.cache.ObjectCacheFactory;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException;
   import org.apache.ojb.broker.metadata.CollectionDescriptor;
  @@ -98,9 +100,6 @@
   import org.apache.ojb.broker.util.sequence.SequenceManager;
   import org.apache.ojb.broker.util.sequence.SequenceManagerException;
   import org.apache.ojb.broker.util.sequence.SequenceManagerFactory;
  -
  -//#ifdef JDK13
  -import java.lang.reflect.Proxy;
   //#else
   /*
   import com.develop.java.lang.reflect.Proxy;
  @@ -762,6 +761,7 @@
       {
           // get all members of obj that are collections and store all their elements
           Iterator i = vecCds.iterator();
  +        
           while (i.hasNext())
           {
               CollectionDescriptor cds = (CollectionDescriptor) i.next();
  @@ -786,13 +786,19 @@
                   }
                   if (cds.isMtoNRelation())
                   {
  -                    currentMtoNKeys = getMtoNImplementor(cds, obj);
  -                    // delete unused m:n implementors
  -                    if (!insert)
  +                    // use empty list on insert (by Andy Malakov)
  +                    if (insert)
  +                    {
  +                        currentMtoNKeys = Collections.EMPTY_LIST;    
  +                    }
  +                    else
                       {
  -                      deleteMtoNImplementor(cds, obj, (Collection)col, currentMtoNKeys);
  +                        currentMtoNKeys = getMtoNImplementor(cds, obj);
  +                        deleteMtoNImplementor(cds, obj, (Collection)col, currentMtoNKeys);
                       }
                   }
  +                
  +                
                   Iterator colIterator;
                   if (col instanceof ManageableCollection)
                   {
  @@ -812,6 +818,7 @@
                               col.getClass()
                               + " can not be managed by OJB, use Array, Collection or ManageableCollection
instead !");
                   }
  +                
                   while (colIterator.hasNext())
                   {
                       Object otherObj = colIterator.next();
  @@ -839,6 +846,7 @@
                           storeCollectionObject(cds, otherObj);
                       }
                   }
  +                
                   // invoke callback on collection
                   if (col instanceof ManageableCollection)
                   {
  
  
  

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