DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
Issue Details (XML | Word | Printable)

Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Renato Garcia
Reporter: Renato Garcia
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
DataNucleus Store RDBMS

AVG on integral number drops decimals on some databases

Created: 04/Apr/14 11:58 AM   Updated: 13/Apr/14 10:45 AM   Resolved: 07/Apr/14 12:35 AM
Component/s: ORM
Affects Version/s: 4.0.0.m2
Fix Version/s: 4.0.0.m3

Datastore: Apache Derby, IBM DB2, HSQL, H2

 Description  « Hide
If you average a integer field with value 10 and 5 it returns 7 instead of 7.5 as expected since the JDO spec defines that AVG should return a Double. This is because some databases e.g. H2,HSQL,Derby,DB2 will use the same type for the AVG return of the parameter. A possible solution for this is to add a cast to force a floating point number parameter.

Renato Garcia added a comment - 07/Apr/14 12:35 AM
Fixed for Derby, H2 and HSQL

Renato Garcia made changes - 07/Apr/14 12:35 AM
Field Original Value New Value
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 13/Apr/14 10:45 AM
Status Resolved [ 5 ] Closed [ 6 ]