db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From olegn...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/metadata CollectionDescriptor.java
Date Sat, 13 Dec 2003 17:35:43 GMT
olegnitz    2003/12/13 09:35:43

  Modified:    src/java/org/apache/ojb/broker/core
                        QueryReferenceBroker.java
               src/java/org/apache/ojb/broker/metadata
                        CollectionDescriptor.java
  Log:
  Don't use auto-prefetching if at least one of extents of collection item class is proxy
  
  Revision  Changes    Path
  1.4       +3 -3      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- QueryReferenceBroker.java	8 Dec 2003 21:34:34 -0000	1.3
  +++ QueryReferenceBroker.java	13 Dec 2003 17:35:43 -0000	1.4
  @@ -495,8 +495,8 @@
       {
           if (forced || cds.getCascadeRetrieve())
           {
  -            if ((m_retrievalTasks != null) && !cds.isLazy() && !cds.isMtoNRelation()
  -                    && (cds.getItemProxyClass() == null)
  +            if ((m_retrievalTasks != null) && !cds.isLazy() 
  +                    && !cds.isMtoNRelation() && !cds.hasProxyItems()
                       && (cds.getQueryCustomizer() == null))
               {
                   addRetrievalTask(obj, cds);
  
  
  
  1.23      +24 -1     db-ojb/src/java/org/apache/ojb/broker/metadata/CollectionDescriptor.java
  
  Index: CollectionDescriptor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/CollectionDescriptor.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- CollectionDescriptor.java	6 Dec 2003 12:30:20 -0000	1.22
  +++ CollectionDescriptor.java	13 Dec 2003 17:35:43 -0000	1.23
  @@ -56,9 +56,11 @@
   
   import java.util.ArrayList;
   import java.util.Collection;
  +import java.util.Iterator;
   import java.util.Vector;
   
   import org.apache.commons.lang.SystemUtils;
  +import org.apache.ojb.broker.PersistenceBrokerException;
   import org.apache.ojb.broker.accesslayer.QueryCustomizer;
   
   
  @@ -108,6 +110,8 @@
   
       private QueryCustomizer m_queryCustomizer;
   
  +    private Boolean m_hasProxyItems;
  +
       public CollectionDescriptor(ClassDescriptor descriptor)
       {
           super(descriptor);
  @@ -402,4 +406,23 @@
   		m_queryCustomizer = queryCustomizer;
   	}
   
  +    public boolean hasProxyItems() throws PersistenceBrokerException
  +    {
  +        if (m_hasProxyItems == null)
  +        {
  +            DescriptorRepository repo = getClassDescriptor().getRepository();
  +            ClassDescriptor cld = repo.getDescriptorFor(getItemClass());
  +            Collection extents = cld.getExtentClasses();
  +            m_hasProxyItems = Boolean.FALSE;
  +            for (Iterator it = extents.iterator(); it.hasNext(); ) {
  +                Class ext = (Class) it.next();
  +                ClassDescriptor cldExt = repo.getDescriptorFor(ext);
  +                if (cldExt.getProxyClass() != null) {
  +                    m_hasProxyItems = Boolean.TRUE;
  +                    break;
  +                }
  +            }
  +        }
  +        return (m_hasProxyItems == Boolean.TRUE);
  +    }
   }
  
  
  

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