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/xdocs query.xml
Date Sat, 15 Mar 2003 19:06:12 GMT
brj         2003/03/15 11:06:12

  Modified:    xdocs    query.xml
  Log:
  Query refactoring
  
  Revision  Changes    Path
  1.16      +12 -10    db-ojb/xdocs/query.xml
  
  Index: query.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/xdocs/query.xml,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- query.xml	13 Mar 2003 15:50:46 -0000	1.15
  +++ query.xml	15 Mar 2003 19:06:12 -0000	1.16
  @@ -161,7 +161,7 @@
   
   <subsection name="ordering and grouping">
   <p>
  -The following methods of Criteria are used for ordering and grouping:
  +The following methods of QueryByCriteria are used for ordering and grouping:
   <ul>
   <li>addOrderByAscending(String anAttributeName);</li>
   <li>addOrderByDescending(String anAttributeName);</li>
  @@ -172,9 +172,9 @@
   
   <source><![CDATA[
   crit = new Criteria();
  -crit.addOrderByDescending("id");
  -crit.addOrderByAscending("lastname");
   query = new QueryByCriteria(Person.class, crit);
  +query.addOrderByDescending("id");
  +query.addOrderByAscending("lastname");
   broker.getCollectionByQuery(query);
   ]]></source>
   
  @@ -190,7 +190,7 @@
   
   <br/>
   When you use the <b>column</b> name "LASTNAME" instead of the <b>attribute</b>
name
  -"lastname" (crit.addOrderBy("LASTNAME");), an additional column named "LASTNAME" without
alias will be
  +"lastname" (query.addOrderBy("LASTNAME");), an additional column named "LASTNAME" without
alias will be
   added.
   
   <source><![CDATA[
  @@ -263,7 +263,7 @@
   <source><![CDATA[
   Criteria crit = new Criteria();
   crit.addLike("allArticlesInGroup.articleName", "F%");
  -Query q = QueryFactory.newQuery(ProductGroup.class, crit, true);
  +QueryByCriteria q = QueryFactory.newQuery(ProductGroup.class, crit, true);
   
   Collection results = broker.getCollectionByQuery(q);
   ]]></source>
  @@ -340,9 +340,10 @@
   
       crit1.addAndCriteria(crit2);
       crit1.addAndCriteria(crit3);
  -    crit1.addOrderBy("company.value");	// user alias
   
       q = QueryFactory.newQuery(Container.class, crit1);
  +    q.addOrderBy("company.value");	    // user alias
  +    
   ]]></source>
   
   <br/>
  @@ -416,10 +417,11 @@
   <source><![CDATA[
   Criteria crit = new Criteria();
   crit.addLessOrEqualThan("groupId", new Integer(5));
  -crit.addOrderByDescending("groupId");
  -crit.addPrefetchedRelationship("allArticlesInGroup");
   
  -Query q = QueryFactory.newQuery(ProductGroup.class, crit);
  +QueryByCriteria q = QueryFactory.newQuery(ProductGroup.class, crit);
  +q.addOrderByDescending("groupId");
  +q.addPrefetchedRelationship("allArticlesInGroup");
  +
   Collection results = broker.getCollectionByQuery(q);
   ]]></source>
   
  @@ -486,7 +488,7 @@
   q.setColumns(new String[] { "groupName",
                               "sum(allArticlesInGroup.stock)",
                               "sum(allArticlesInGroup.price)" });
  -crit.addGroupBy("groupName");
  +q.addGroupBy("groupName");
   
   Iterator iter = broker.getReportQueryIteratorByQuery(q);
   ]]></source>
  
  
  

Mime
View raw message