Adding results

1

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

Something like (simplified):

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

I did:

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

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

    
asked by anonymous 18.11.2014 / 18:00

0 answers