Re: questions

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Feb 13 2008 - 14:36:18 EST

  • Next message: Eric Polino: "Re: questions"

    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



    This archive was generated by hypermail 2.0.0 : Wed Feb 13 2008 - 14:36:53 EST