问题 How can I tranform the following query to a hibernate Criteria? select pr_name, count(*) from (select (case when serv.type=xyz then serv.nameA else serv.nameB end) as pr_name from db.serv serv where serv.date is null group by pr_name; I have got the following to handle the rest (except for the case part) currentSession.createCriteria(StoredData.class) .setProjection(projectionList() .add(groupProperty("pr_name"), "pr_name") .add(rowCount(), "count")) .add(isNull("date")) .setResultTransformer