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 QueryReferenceBroker.java
Date Tue, 30 Dec 2003 21:09:19 GMT
brj         2003/12/30 13:09:19

  Modified:    src/java/org/apache/ojb/broker/core
                        QueryReferenceBroker.java
  Log:
  OJB203: fixed ClassCastException in retrieveCollection 
  fix by B Souza
  
  Revision  Changes    Path
  1.6       +14 -14    db-ojb/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
  
  Index: QueryReferenceBroker.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- QueryReferenceBroker.java	28 Dec 2003 18:13:14 -0000	1.5
  +++ QueryReferenceBroker.java	30 Dec 2003 21:09:19 -0000	1.6
  @@ -54,11 +54,18 @@
    * <http://www.apache.org/>.
    */
   
  +import java.lang.reflect.Array;
  +import java.util.ArrayList;
  +import java.util.Collection;
  +import java.util.HashMap;
  +import java.util.Iterator;
  +import java.util.List;
  +import java.util.Map;
  +
   import org.apache.ojb.broker.Identity;
   import org.apache.ojb.broker.ManageableCollection;
   import org.apache.ojb.broker.PersistenceBrokerException;
   import org.apache.ojb.broker.VirtualProxy;
  -import org.apache.ojb.broker.accesslayer.*;
   import org.apache.ojb.broker.accesslayer.CollectionProxy;
   import org.apache.ojb.broker.accesslayer.CollectionProxyListener;
   import org.apache.ojb.broker.accesslayer.IndirectionHandler;
  @@ -66,6 +73,7 @@
   import org.apache.ojb.broker.accesslayer.OJBIterator;
   import org.apache.ojb.broker.accesslayer.PlainPrefetcher;
   import org.apache.ojb.broker.accesslayer.RelationshipPrefetcher;
  +import org.apache.ojb.broker.accesslayer.RelationshipPrefetcherFactory;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException;
   import org.apache.ojb.broker.metadata.CollectionDescriptor;
  @@ -82,15 +90,6 @@
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   
  -import java.lang.reflect.Array;
  -import java.util.ArrayList;
  -import java.util.Collection;
  -import java.util.HashMap;
  -import java.util.Iterator;
  -import java.util.List;
  -import java.util.Map;
  -import java.util.Vector;
  -
   /**
    * Encapsulates 1:1 and 1:n references and collection references stuff.
    *
  @@ -495,7 +494,7 @@
       {
           if (forced || cds.getCascadeRetrieve())
           {
  -            if ((m_retrievalTasks != null) && !cds.isLazy()
  +            if ((m_retrievalTasks != null) && !cds.isLazy() 
                       && !cds.hasProxyItems()
                       && (cds.getQueryCustomizer() == null))
               {
  @@ -520,9 +519,10 @@
                           int length = result.size();
                           Class itemtype = collectionField.getType().getComponentType();
                           Object resultArray = Array.newInstance(itemtype, length);
  -                        for (int j = 0; j < length; j++)
  +                        int j = 0;
  +                        for (Iterator iter = result.iterator(); iter.hasNext();j++)
                           {
  -                            Array.set(resultArray, j, ((Vector) result).get(j));
  +                            Array.set(resultArray, j, iter.next());
                           }
                           collectionField.set(obj, resultArray);
                       }
  
  
  

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