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); Andrus