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/singlevm PersistenceBrokerImpl.java
Date Mon, 17 Mar 2003 18:12:00 GMT
brj         2003/03/17 10:12:00

  Modified:    src/java/org/apache/ojb/broker/singlevm
                        PersistenceBrokerImpl.java
  Log:
  Query refactoring
  
  Revision  Changes    Path
  1.146     +11 -6     db-ojb/src/java/org/apache/ojb/broker/singlevm/PersistenceBrokerImpl.java
  
  Index: PersistenceBrokerImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/singlevm/PersistenceBrokerImpl.java,v
  retrieving revision 1.145
  retrieving revision 1.146
  diff -u -r1.145 -r1.146
  --- PersistenceBrokerImpl.java	16 Mar 2003 18:10:22 -0000	1.145
  +++ PersistenceBrokerImpl.java	17 Mar 2003 18:12:00 -0000	1.146
  @@ -1042,14 +1042,15 @@
               Class collectionClass = cds.getCollectionClass();
               PersistentField collectionField = cds.getPersistentField();
               Query fkQuery = null;
  +            QueryByCriteria fkQueryCrit = null;
               
               if (cds.isMtoNRelation())
               {
  -                fkQuery = getMtoNQuery(obj, cld, cds);
  +                fkQueryCrit = getMtoNQuery(obj, cld, cds);
               }
               else
               {
  -                fkQuery = getForeignKeyQuery(obj, cld, cds);
  +                fkQueryCrit = getForeignKeyQuery(obj, cld, cds);
               }
   
               // check if collection must be ordered
  @@ -1058,16 +1059,20 @@
                   Iterator iter = cds.getOrderBy().iterator();
                   while (iter.hasNext())
                   {
  -                    ((QueryByCriteria)fkQuery).addOrderBy((FieldHelper)iter.next());
  +                    fkQueryCrit.addOrderBy((FieldHelper)iter.next());
                   }
               }
   
               // BRJ: customize the query
               if (cds.getQueryCustomizer() != null)
               {
  -                fkQuery = cds.getQueryCustomizer().customizeQuery(obj,this, cds, fkQuery);
  +                fkQuery = cds.getQueryCustomizer().customizeQuery(obj,this, cds, fkQueryCrit);
               }
  -
  +            else
  +            {
  +                fkQuery = fkQueryCrit;
  +            }
  +            
               if (collectionClass == null)
               {
                   Collection result = getCollectionByQuery(fkQuery, cds.isLazy());
  
  
  

Mime
View raw message