119 words

Issue #236 - Wrong type on SUM function

BugVersion: 2.5.6Priority: NormalStatus: FixedReplies: 1
2014-11-11 17:34


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.


Pablo Berra
Pablo Berra's picture
Joined on 2014-03-12
User Post #1
2014-11-12 12:26

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)
support's picture
Joined on 2010-05-03
User Post #2,082

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Maximum file size: 32 MB