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 Thu, 24 Apr 2003 20:10:14 GMT
brj         2003/04/24 13:10:14

  Modified:    xdocs    query.xml
  Log:
  new feature to define the join type
  
  Revision  Changes    Path
  1.19      +25 -1     db-ojb/xdocs/query.xml
  
  Index: query.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/xdocs/query.xml,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- query.xml	15 Apr 2003 18:45:31 -0000	1.18
  +++ query.xml	24 Apr 2003 20:10:14 -0000	1.19
  @@ -51,7 +51,7 @@
   </p>
   
   <p>
  -To create a DISTINCT-Query, simply add <b>true</b> as third parameter.  
  +To create a DISTINCT-Query, simply add <b>true</b> as third parameter.
   <source><![CDATA[
   Query q = QueryFactory.newQuery(Person.class, crit, true);
   ]]></source>
  @@ -297,6 +297,30 @@
   
   </p>
   
  +OJB tries to do it's best to automatically use <b>outer</b> joins where needed.
  +This is currently the case for classes having extents and ORed criteria. 
  +But you can force the SQLGenerator to use outer joins where you find it useful.
  +<br/>
  +This is done by the method <FONT FACE="Courier, monospace">QueryByCriteria#setPathOuterJoin(String)</FONT>.
  +
  +<source><![CDATA[
  +ReportQueryByCriteria query;
  +Criteria crit;
  +Iterator result1, result2;
  +        
  +crit = new Criteria();
  +        
  +query = new ReportQueryByCriteria(Person.class, crit);
  +query.setColumns(new String[] { "id", "name", "vorname", "sum(konti.saldo)" });
  +query.addGroupBy(new String[]{ "id", "name", "vorname" });
  +
  +result1 = broker.getReportQueryIteratorByQuery(query);
  +              
  +query.setPathOuterJoin("konti");
  +result2 = broker.getReportQueryIteratorByQuery(query);
  +]]></source>
  +
  +The first query will use an inner join, the second an outer join.
   </subsection>
   
   
  
  
  

Mime
View raw message