db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acl...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/accesslayer MtoNCollectionPrefetcher.java
Date Wed, 27 Apr 2005 14:25:31 GMT
aclute      2005/04/27 07:25:31

  Modified:    src/java/org/apache/ojb/broker/accesslayer
                        MtoNCollectionPrefetcher.java
  Log:
  [JIRA]OJB-32 -- Fix that allows for the MtoNCollectionPrefetcher to respect the orderby's
for a collection descriptor.
  
  Revision  Changes    Path
  1.24      +13 -1     db-ojb/src/java/org/apache/ojb/broker/accesslayer/MtoNCollectionPrefetcher.java
  
  Index: MtoNCollectionPrefetcher.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/MtoNCollectionPrefetcher.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- MtoNCollectionPrefetcher.java	23 Apr 2005 14:39:52 -0000	1.23
  +++ MtoNCollectionPrefetcher.java	27 Apr 2005 14:25:31 -0000	1.24
  @@ -33,6 +33,7 @@
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.broker.metadata.CollectionDescriptor;
   import org.apache.ojb.broker.metadata.FieldDescriptor;
  +import org.apache.ojb.broker.metadata.FieldHelper;
   import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor;
   import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
   import org.apache.ojb.broker.query.Criteria;
  @@ -162,6 +163,17 @@
           ReportQueryByCriteria q = getQueryFactory().newMtoNReportQuery(getItemClassDescriptor().getClassOfObject(),
cols,
                   crit, false, getCollectionDescriptor().getIndirectionTable());
           q.setJdbcTypes(jdbcTypes);
  +        
  +        CollectionDescriptor cds = getCollectionDescriptor();
  +        //check if collection must be ordered
  +        if (!cds.getOrderBy().isEmpty())
  +        {
  +            Iterator iter = cds.getOrderBy().iterator();
  +            while (iter.hasNext())
  +            {
  +                q.addOrderBy((FieldHelper) iter.next());
  +            }
  +        }
   
           return q;
       }
  
  
  

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