File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes count(*) and groupby - Projections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "count(*) and groupby - Projections" Watch "count(*) and groupby - Projections" New topic

count(*) and groupby - Projections

JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303
I have a query

I am trying to use Hibernate detached criteria and have the following code:

This generates the above query with count(*). What should i add to get the count(*) in the query?
I tried projectionsCriteria.setProjection(Projections.count("column1")); and

that does not work. Any ideas?

SCJP 1.4, SCWCD 1.4<br /> <br />Thanks in advance!<br />Jayashree.
It is sorta covered in the JavaRanch Style Guide.
subject: count(*) and groupby - Projections
jQuery in Action, 3rd edition