[jboss-user] [JBoss Seam] - Re: count(*) and group by

wschwendt do-not-reply at jboss.com
Wed Jul 25 09:36:15 EDT 2007

"artur.chyzy" wrote : what about the native sql solution.. 
  | override the count query methods and use native sql for it...

if you override Query.getCountEjbql() there's actually no real need to resort to native SQL queries, at least in most cases.    JPA QL allows a COUNT expression in a query, even though it's not legal (or portable) to write COUNT(*).   See BNF grammar above taken from the JPA spec.  So you could easily provide a custom JPA QL count query.

The reason why in Seam the count query gets generated obviously has to do with the fact that the Seam framework supports the XML-based declaration of EntityQuery objects and query restriction fragments, without the developer being required to write any Java code.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067394#4067394

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067394

More information about the jboss-user mailing list