CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Tuple> cq = cb.createQuery(Tuple.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.equal(root.get(Task_.person), person);
javax.persistence.criteria.Path<String> applicationNamePath =
root.get(Task_.applicationName);
Expression<Long> countPath = cb.count(applicationNamePath);
/*here is the problem*/
cq.multiselect(applicationNamePath,
countPath).where(p).groupBy(applicationNamePath);
for (Tuple o : em.createQuery(cq).getResultList()) {
        WrapOutCountApplication wrap = new WrapOutCountApplication();
        wrap.setApplicationName(o.get(applicationNamePath));
        wrap.setCount(o.get(countPath));
        list.add(wrap);
}

expect return mulit row,but it only return the first row.
is this a bug?




--
View this message in context: 
http://openjpa.208410.n2.nabble.com/groupBy-only-return-first-row-of-resultSet-tp7588359.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to