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 Mon, 10 May 2004 18:22:27 GMT
brj         2004/05/10 11:22:27

  Modified:    forrest/src/documentation/content/xdocs/docu query.xml
               xdocs    query.xml
  Log:
  better example for Criteria#addPathClass
  
  Revision  Changes    Path
  1.4       +23 -11    db-ojb/forrest/src/documentation/content/xdocs/docu/query.xml
  
  Index: query.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/forrest/src/documentation/content/xdocs/docu/query.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- query.xml	1 May 2004 15:17:45 -0000	1.3
  +++ query.xml	10 May 2004 18:22:27 -0000	1.4
  @@ -518,21 +518,33 @@
               <section>
                   <title>class hints</title>
                   <p>
  -                    This feature allows the user to specify which class of an extent to
use for a path-segment. 
  +                    This feature allows the user to specify which class of an extent to
use for a path-segment.
                       The standard behaviour of OJB is to use the base class of an extent
when it resolves a path-segment.
                   </p>
  -                <p>                
  -                    In the following sample the path <strong>allArticlesInGroup</strong>
points to class Article, 
  -                    this is defined in the repository.xml. Assume we are only interested
in CdArticles, a class hint can be
  +                <p>
  +                    In the following sample the path <strong>allArticlesInGroup</strong>
points to class Article,
  +                    this is defined in the repository.xml. Assume we are only interested
in ProductGroups containing CdArticles 
  +                    performed by Eric Clapton or Books authored by Eric Clapton, a class
hint can be
                       defined for the path. This hint is defined by: <br/><br/>
                       Criteria#<strong>addPathClass</strong>("allArticlesInGroup",
CdArticle.class);
                   </p>
  -                    
  +
                       <source><![CDATA[
  -crit = new Criteria();
  -crit.addEqualTo("allArticlesInGroup.articleId", new Integer(cd.getArticleId()));
  -query = new QueryByCriteria(ProductGroup.class, crit);
  -crit.addPathClass("allArticlesInGroup", CdArticle.class);
  +//                    
  +// find a ProductGroup with a CD or a book by a particular artist
  +//
  +String artistName = new String("Eric Clapton");
  +crit1 = new Criteria();
  +crit1.addEqualTo("allArticlesInGroup.musicians", artistName);
  +crit1.addPathClass("allArticlesInGroup", CdArticle.class);
  +
  +crit2 = new Criteria();
  +crit2.addEqualTo("allArticlesInGroup.author", artistName);
  +crit2.addPathClass("allArticlesInGroup", BookArticle.class);
  +
  +crit1.addOrCriteria(crit2);
  +
  +query = new QueryByCriteria(ProductGroup.class, crit1);
   broker.getObjectByQuery(query);
   ]]></source>
   
  @@ -540,7 +552,7 @@
                       This feature is also available in class QueryByCriteria but using it
on Criteria-level provides
                       additional flexibility. QueryByCriteria#addPathClass may be deprecated
in the future.
   				</note>
  -				
  +
               </section>
   
               <section>
  
  
  
  1.30      +22 -10    db-ojb/xdocs/query.xml
  
  Index: query.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/xdocs/query.xml,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- query.xml	1 May 2004 15:17:46 -0000	1.29
  +++ query.xml	10 May 2004 18:22:27 -0000	1.30
  @@ -535,21 +535,33 @@
   
               <subsection name="class hints">
                   <p>
  -                    This feature allows the user to specify which class of an extent to
use for a path-segment. 
  +                    This feature allows the user to specify which class of an extent to
use for a path-segment.
                       The standard behaviour of OJB is to use the base class of an extent
when it resolves a path-segment.
                   </p>
  -                <p>                
  -                    In the following sample the path <strong>allArticlesInGroup</strong>
points to class Article, 
  -                    this is defined in the repository.xml. Assume we are only interested
in CdArticles, a class hint can be
  +                <p>
  +                    In the following sample the path <strong>allArticlesInGroup</strong>
points to class Article,
  +                    this is defined in the repository.xml. Assume we are only interested
in ProductGroups containing CdArticles 
  +                    performed by Eric Clapton or Books authored by Eric Clapton, a class
hint can be
                       defined for the path. This hint is defined by: <br/><br/>
                       Criteria#<strong>addPathClass</strong>("allArticlesInGroup",
CdArticle.class);
                   </p>
  -                    
  +
                       <source><![CDATA[
  -crit = new Criteria();
  -crit.addEqualTo("allArticlesInGroup.articleId", new Integer(cd.getArticleId()));
  -query = new QueryByCriteria(ProductGroup.class, crit);
  -crit.addPathClass("allArticlesInGroup", CdArticle.class);
  +//                    
  +// find a ProductGroup with a CD or a book by a particular artist
  +//
  +String artistName = new String("Eric Clapton");
  +crit1 = new Criteria();
  +crit1.addEqualTo("allArticlesInGroup.musicians", artistName);
  +crit1.addPathClass("allArticlesInGroup", CdArticle.class);
  +
  +crit2 = new Criteria();
  +crit2.addEqualTo("allArticlesInGroup.author", artistName);
  +crit2.addPathClass("allArticlesInGroup", BookArticle.class);
  +
  +crit1.addOrCriteria(crit2);
  +
  +query = new QueryByCriteria(ProductGroup.class, crit1);
   broker.getObjectByQuery(query);
   ]]></source>
   
  @@ -558,7 +570,7 @@
                       This feature is also available in class QueryByCriteria but using it
on Criteria-level provides
                       additional flexibility. QueryByCriteria#addPathClass may be deprecated
in the future.
   				</note>
  -				
  +
               </subsection>
   
   
  
  
  

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