Home » Support » Forum » Inconsistent return types from JDO query

Inconsistent return types from JDO query

#1

I'm running a JDO query which returns the sum of an int field.  The return type of the Object produced by the Query is inconsistent - sometimes Integer, sometimes Long.  Using setResultClass(Long.class) has no effect.

#2

The type of a sum expression depends on the type of the field on which it works, but should be long for both int and long fields.

Please post the query and specify the relevant types.

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

I am attaching sample code which reproduces the problem.

text/x-java iconTest.java (1.07KB)
PersistenceCapable class
#4

Thank you for this report and for the test. It shows that the sum of a single result uses the type of the original value rather than long as required. Build 2.5.6_01 fixes it.

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

Excellent.  Thank you.


Post Reply

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