Perhaps look at CountQuery here: http://cayenne.apache.org/doc/customizing-queries.html
/dev/mrg On Feb 13, 2008 3:08 PM, Eric Polino <[EMAIL PROTECTED]> wrote: > > On Feb 13, 2008 2:36 PM, Andrus Adamchik <[EMAIL PROTECTED]> wrote: > > On Feb 13, 2008, at 1:48 PM, Eric Polino wrote: > > > 1. How do I count the rows of a query, without actually doing a full > > > blown SelectQuery and counting the elements? ie: select count(*) from > > > table; > > > > For aggregate queries I suggest EJBQLQuery (only available in 3.0)... > > It uses the same approach of joins expressed as relationships as > > SelectQuery, only it also allows aggregate expressions. E.g.: > > > > EJBQLQuery query = new EJBQLQuery("select count(a) from Artist a > > WHERE a.artistName like 'X%'"); > > Number count = (Number) DataObjectUtils.objectForQuery(query); > > Cool, but we've been having trouble upgrading to 3.0 (we're on 2.0). > Short of upgrading for this feature, any suggestions on what we can do > in 2.0? > > > Andrus > > > > > > > > > -- > "None are more hopelessly enslaved than those who falsely believe they > are free." > --Goethe > > "Freedom is living without government coercion." > --Ron Paul (www.ronpaul2008.com) >