db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r371114 - /db/torque/runtime/trunk/xdocs/reference/read-from-db.xml
Date Sat, 21 Jan 2006 20:48:30 GMT
Author: tfischer
Date: Sat Jan 21 12:48:25 2006
New Revision: 371114

URL: http://svn.apache.org/viewcvs?rev=371114&view=rev
Log:
Forgot to include the subselect feature added after 3.2.
It is commented, because we might want to republish the site as 3.2 docs.

Modified:
    db/torque/runtime/trunk/xdocs/reference/read-from-db.xml

Modified: db/torque/runtime/trunk/xdocs/reference/read-from-db.xml
URL: http://svn.apache.org/viewcvs/db/torque/runtime/trunk/xdocs/reference/read-from-db.xml?rev=371114&r1=371113&r2=371114&view=diff
==============================================================================
--- db/torque/runtime/trunk/xdocs/reference/read-from-db.xml (original)
+++ db/torque/runtime/trunk/xdocs/reference/read-from-db.xml Sat Jan 21 12:48:25 2006
@@ -590,6 +590,35 @@
     
   </section>
 
+  <!--section name="subselects">
+    <p>
+      To use a subselect, simply put a criteria which represents the 
+      subselect at the place where you would normally specify the column
+      value(s) explicitly.
+    </p>
+    
+    <p>
+      Do not forget to specify the selectColumns in the Criteria representing
+      the subselect (usually, the Peer classes do this for you, but not in the 
+      subselect).
+    </p>
+    
+    <p>
+      As an example, assume we want to read the author with the largest authorId
+      from the database. This can be done as follows:
+    </p>
+    
+<source>
+Criteria subquery = new Criteria();
+subquery.addSelectColumn("MAX(" + AuthorPeer.AUTHOR_ID + ")");
+
+Criteria criteria = new Criteria();
+criteria.add(AuthorPeer.AUTHOR_ID, subquery);
+
+List authors = AuthorPeer.doSelect(criteria);
+</source>
+  </section-->
+
   <section name="Using Criterion to use a Column twice in a Criteria">
 
     <p>



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


Mime
View raw message