Can I write this query using the criteria API or am I stuck with HQL?

Posted by Yannis on Stack Overflow See other posts from Stack Overflow or by Yannis
Published on 2010-02-12T06:42:58Z Indexed on 2010/03/23 21:03 UTC
Read the original article Hit count: 197

Filed under:

hi all. I have the following query which I would like to write using the criteria api of NH.

select status, count(1) from (select distinct Status, post_id from post_statistics) tbl group by status

each post_id can exist multiple times in post_statistics

e.g.

id post_id status 1 1 open 1 1 edit 1 1 open 1 2 open

so the query should return the following results:

status count open 2 edit 1

thx in advance.

© Stack Overflow or respective owner

Related posts about nhibernate