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, 13 Mar 2003 15:50:47 GMT
brj         2003/03/13 07:50:47

  Modified:    xdocs    query.xml
  Log:
  fixed user alias sample
  
  Revision  Changes    Path
  1.15      +15 -14    db-ojb/xdocs/query.xml
  
  Index: query.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/xdocs/query.xml,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- query.xml	8 Mar 2003 10:22:51 -0000	1.14
  +++ query.xml	13 Mar 2003 15:50:46 -0000	1.15
  @@ -307,7 +307,7 @@
   class Container
       int id
       Collection allAbstractAttributes
  -    
  +
   class AbstractAttribute
       int id
       inf ref_id
  @@ -315,7 +315,7 @@
       String value
       Collection allAbstractAttributes
   </pre>
  -    
  +
   OJB maps these classes to separate tables where it maps
   allAbstractAttributes using a collectiondescriptor to AbstractAttribute
   using ref_id as inverse foreignkey on Container for the collection
  @@ -330,17 +330,18 @@
       crit1.addEqualTo("allAbstractAttributes.value", new String("iBanx"));
   
       Criteria crit2 = new Criteria();
  +    crit2.setAlias("contact");			// set an alias
       crit2.addEqualTo("allAbstractAttributes.name", new String("contactPerson"));
       crit2.addLike("allAbstractAttributes.value", new String("janssen"));
   
       Criteria crit3 = new Criteria();
       crit3.addEqualTo("allAbstractAttributes.name", new String("size"));
       crit3.addGreaterThan("allAbstractAttributes.value", new Integer(500));
  -    
  +
       crit1.addAndCriteria(crit2);
  -    crit1.addAndCriteria(crit3); 
  +    crit1.addAndCriteria(crit3);
       crit1.addOrderBy("company.value");	// user alias
  -    
  +
       q = QueryFactory.newQuery(Container.class, crit1);
   ]]></source>
   
  @@ -349,9 +350,9 @@
   <br/>
   
   <source><![CDATA[
  -    SELECT DISTINCT A0.ID, A1.VALUE 
  -    FROM CONTAINER A0 INNER JOIN ABSTRACT_ATTRIBUTE A1 
  -         ON A0.ID=A1.REF_ID 
  +    SELECT DISTINCT A0.ID, A1.VALUE
  +    FROM CONTAINER A0 INNER JOIN ABSTRACT_ATTRIBUTE A1
  +         ON A0.ID=A1.REF_ID
            INNER JOIN ABSTRACT_ATTRIBUTE A2
            ON A0.ID=A2.REF_ID
            INNER JOIN ABSTRACT_ATTRIBUTE A3
  @@ -376,11 +377,11 @@
       crit2.setAlias("ALIAS2");
       crit2.addEqualTo("allAbstractAttributes.name", new String("yyyy"));
       crit2.addLike("allAbstractAttributes.value", new String(""));
  -    
  +
       crit1.addAndCriteria(crit2);
  -    
  +
       q = QueryFactory.newReportQuery(Container.class, crit1);
  -    
  +
       String[] cols = { id, "ALIAS2.name", "ALIAS2.name", "ALIAS1.name", "ALIAS1.name" };
       q.setColumns(cls);
   ]]></source>
  @@ -390,9 +391,9 @@
   <br/>
   
   <source><![CDATA[
  -    SELECT DISTINCT A0.ID, A1.NAME, A1.VALUE, A2.NAME, A2.VALUE 
  -    FROM CONTAINER A0 INNER JOIN ABSTRACT_ATTRIBUTE A1 
  -         ON A0.ID=A1.REF_ID 
  +    SELECT DISTINCT A0.ID, A1.NAME, A1.VALUE, A2.NAME, A2.VALUE
  +    FROM CONTAINER A0 INNER JOIN ABSTRACT_ATTRIBUTE A1
  +         ON A0.ID=A1.REF_ID
            INNER JOIN ABSTRACT_ATTRIBUTE A2
            ON A1.ID=A2.REF_ID
       WHERE (( A2.NAME =  'xxxx' ) AND  (A2.VALUE =  'hello' )) AND
  
  
  

Mime
View raw message