die Methoden QueryDefinition#groupBy und #having angegeben QueryDefinition q = qb.createQueryDefinition(); DomainObject cd = q.addRoot(Record.class); q.select(cd.get("status"), cd.get("rating").avg(), cd.count()) .groupBy(cd.get("status")) .having(q.get("status").in(1, 2)); SELECT cd.status, AVG(cd.rating), COUNT(cd) FROM Record cd GROUP BY cd.status HAVING cd.status IN (1, 2)