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/doc/forrest/src/documentation/content/xdocs/docu/guides query.xml
Date Sat, 09 Apr 2005 12:52:25 GMT
brj         2005/04/09 05:52:25

  Modified:    src/doc/forrest/src/documentation/content/xdocs/docu/guides
                        query.xml
  Log:
  short description of Criteria#addEqualToIdentity
  
  Revision  Changes    Path
  1.4       +30 -4     db-ojb/src/doc/forrest/src/documentation/content/xdocs/docu/guides/query.xml
  
  Index: query.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/doc/forrest/src/documentation/content/xdocs/docu/guides/query.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- query.xml	15 Jan 2005 13:09:22 -0000	1.3
  +++ query.xml	9 Apr 2005 12:52:25 -0000	1.4
  @@ -39,9 +39,9 @@
   
           <anchor id="query-by-criteria"/>
           <section>
  -            <title>Query by Criteria</title>
  +            <title>PB-API Query by Criteria</title>
               <p>
  -                In this section you will learn how to use the query by criteria.
  +                In this section you will learn how to use the query by criteria of the
PB-API.
                   The classes are located in the package
                   <code>org.apache.ojb.broker.query</code>.
                   Using query by criteria you can either
  @@ -112,6 +112,7 @@
                           </p>
                       <ul>
                           <li>addEqualTo</li>
  +                        <li>addIdentityEqualTo</li>
                           <li>addLike</li>
                           <li>addGreaterOrEqualThan</li>
                           <li>addGreaterThan</li>
  @@ -182,6 +183,31 @@
                   </section>
   
                   <section>
  +                    <title>equal to Identity</title>
  +                    <p>
  +                        Instead of using the primary keys of an object as a selection criterion,
<strong>addEqualToIdentity</strong>
  +                        supports the whole Identity. This feature leads to more readable
queries and is useful, when the object has multiple pk.
  +                    </p>
  +                    <p>    
  +                        The following sample looks for projects of a given person. When
querying for simple attributes we would use
  +                        crit.addEqualTo("persons.id", personId); where id is the primary
key of person. 
  +                        Criteria#addEqualToIdentity accepts the whole Identity and translates
it into an addEqualTo() for each primary key.
  +                    </p>
  +                        <source><![CDATA[
  +        Person p = new Person();
  +        p.setFirstname("tom");
  +        p.setLastname(name);
  +        Identity id = broker.serviceIdentity().buildIdentity(p);
  +
  +        Criteria crit = new Criteria();
  +        crit.addIdentityEqualTo("persons", id);
  +
  +        Query q = QueryFactory.newQuery(Project.class, crit);
  +        Collection results = broker.getCollectionByQuery(q);
  +						]]></source>
  +                </section>
  +
  +                <section>
                       <title>negating the criteria</title>
                       <p>
                           A criteria can be negated to obtain
  @@ -664,7 +690,7 @@
                   <section>
   	                <title>Limitations of Report Queries</title>
   					<p>
  -    	            ReportQueries currently only support simple arithmetic expressions (ie.
price * 1.05). 
  +    	            ReportQueries currently only support simple arithmetic expressions (ie.
price * 1.05).
       	            Expressions based on multiple attributes (ie. price - bonus) do not work.
       	            </p>
   					<p>
  
  
  

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