openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pinaki Poddar <ppod...@apache.org>
Subject Re: Query syntax question about COUNT(x) and GROUP BY
Date Fri, 20 Aug 2010 13:30:54 GMT

Try a subquery such as

        String countQuery = "select count(c) from Customer c " 
                                    + "where exists (select a FROM Address a
" 
                                    +                      "where a.customer
= c and lower(a.city) like :city)";

One suggestion: prefer query parameters over fixed strings. Lots of
advantages.

-----
Pinaki 
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Query-syntax-question-about-COUNT-x-and-GROUP-BY-tp5440084p5444496.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message