Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
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
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.
I agree. Here's the link:
subject: count(*) and groupby - Projections
It's not a secret anymore!