Hello,
I have a problem when I run this aggregation query:
Query q = em.createQuery( "SELECT cc.totalCC.moneda, SUM(cc.totalCC.importe) FROM ComprobanteContable cc " + "WHERE cc.cuenta=:cuenta GROUP BY cc.totalCC.moneda"); List<Object[]> resultList = q.setParameter("cuenta", this).getResultList();
The problem is about SUM on cc.totalCC.importe, a BigDecimal field.
It works fine on all groups giving to me the correct sum BigDecimal value, except in one group that have only one object with a BigDecimal value that has no decimals, for this group it returns a Long type value instead a BigDecimal one.
Of course I have checked and all my objects have BigDecimal fields, so there is no reason to return a Long value.
Thank you.