users@glassfish.java.net

Re: How to create EQL with aggregation function count, SELECT new DTO

From: <glassfish_at_javadesktop.org>
Date: Fri, 16 Feb 2007 12:47:42 PST

Thanks for your answer

I create new defect
https://glassfish.dev.java.net/issues/show_bug.cgi?id=2440.

But it does not solve my problem, because this EQL

[b]SELECT new dto.PersonDTO(res.id, res.firstname, res.surname, count(f))
FROM Person res JOIN res.friends f
WHERE res.id=:id GROUP BY res.id, res.firstname, res.surname[/b]

does not work too.

Is there another way to write this type of query?

For example - see spec. ejb-3_0-fr-spec-persistence.pdf page 96
[b]SELECT c
FROM Customer c
WHERE (SELECT COUNT(o) FROM c.orders o) > 10[/b]

I need the value of subquery to use as argument to PersonDTO construktor.

Fafi
[Message sent by forum member 'fafi' (fafi)]

http://forums.java.net/jive/thread.jspa?messageID=204120