You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by br...@apache.org on 2003/12/14 12:16:13 UTC

cvs commit: db-ojb/xdocs query.xml

brj         2003/12/14 03:16:13

  Modified:    xdocs    query.xml
  Log:
  added negating a criteria
  
  Revision  Changes    Path
  1.25      +22 -0     db-ojb/xdocs/query.xml
  
  Index: query.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/xdocs/query.xml,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- query.xml	8 Dec 2003 17:46:14 -0000	1.24
  +++ query.xml	14 Dec 2003 11:16:13 -0000	1.25
  @@ -170,6 +170,28 @@
   </p>
   </subsection>
   
  +<subsection name="negating the criteria">
  +<p>
  +A criteria can be negated to obtain <b>NOT</b> in the WHERE-clause:
  +
  +<source><![CDATA[
  +Criteria crit1 = new Criteria();
  +crit1.addLike("firstname", "%o%");
  +crit1.addLike("lastname", "%m%");
  +crit1.setNegative(true);
  +
  +Collection results = broker.getCollectionByQuery(q);
  +]]></source>
  +
  +<br/>
  +This query will generate an SQL statement like this:
  +
  +<source><![CDATA[
  +SELECT ... WHERE NOT (FIRSTNAME LIKE "%o%" AND LASTNAME LIKE "%m%")
  +]]></source>
  +
  +</p>
  +</subsection>
   </subsection>
   
   <subsection name="ordering and grouping">
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org