On 10/06/2008, at 5:52 PM, Lachlan Deck wrote:
> Hi Andrus,
>
> On 10/06/2008, at 5:37 PM, Andrus Adamchik wrote:
>
>> On Jun 10, 2008, at 10:31 AM, Lachlan Deck wrote:
>>
>>> Perhaps I should describe what I'm actually doing. All I need is a
>>> way to get a count of a select query (without having to fault in
>>> all the related objects). So is there a way to trigger that, in
>>> order to just get a count back, with a SelectQuery without going
>>> the sqltemplate or namedquery route?
>>
>> I think EJBQL route is the way to go for aggregate object queries.
>> In fact Expression has 'toEJBQLString' method, but you may not even
>> care about it.
Actually, I may indeed care... to to tweak your example are you saying
I could do this...
>> EJBQLQuery countQuery = new EJBQLQuery("SELECT count(a) FROM Artist
>> a WHERE a.artistName like 'A%'");
Expression expression; // assume exists
EJBQLQuery countQuery = new EJBQLQuery("SELECT count(*) FROM Artist a
WHERE " + expression.toEJBQLString("a"));
Is that the intention?
with regards,
--Lachlan Deck
This archive was generated by hypermail 2.0.0 : Tue Jun 10 2008 - 04:04:43 EDT