Home » Support » Issue Tracking » Wrong type on SUM function

Wrong type on SUM function

Type: BugVersion: 2.5.6Priority: NormalStatus: FixedReplies: 1


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.



Thank you for this report. A fix is included in build 2.5.7_05.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login