Adding up results

Asked

Viewed 63 times

1

I’m starting to use the framework uaiCriteria and I need a result that is a sum of records in a period.

Something like (simplified):

select sum(valor), sum(desconto), data, idpessoa from tabela group by data, idpessoa

Fez:

UaiCriteria<Despesa> uc = UaiCriteriaFactory.createQueryCriteria(getEntityManager(), Despesa.class);
uc.sum("valor").sum("desconto").groupBy("data","pessoa");

I hoped he would return to me a collection of objects (Despesa) with the totaled attributes. but it returns me only one object Despesa with the value of only one of the objects.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.