Hi,
i have a problem creating a SQL Query containing COUNT(*) values:
Code:
_query =
"select {c.*}, " +
"count(distinct task.task_id) as {tcount}, " +
"count(distinct ih.issue_id) as {ihcount}, " +
"count(distinct im.issue_id) as {imcount} " +
"from coordinator {c} " +
"left outer join task on c.coordinator_id=task.responsible_id and (task.status=0 or task.status=1) " +
"left outer join issue ih on c.coordinator_id = ih.coordinator_id and ih.risk='High' and (ih.status=0 or ih.status=2) " +
"left outer join issue im on c.coordinator_id = im.coordinator_id and im.risk='Medium' and (im.status=0 or im.status=2) " +
"group by c.coordinator_id " +
"order by c.name asc";
Query query = _session.createSQLQuery(
_query,
new String[] { "c", "tcount", "ihcount", "imcount" },
new Class[] { Coordinator.class, Integer.class, Integer.class, Integer.class });
return query.list().iterator();
This code does not work, because it results in "No Persister for class Integer".
Regards,
Ralf