mirror of
https://github.com/apache/openjpa.git
synced 2025-02-08 19:15:21 +00:00
OPENJPA-2862 select SUM return types fixed
As per spec section 4.8.5 Aggregate Functions in the SELECT clause we need to handle a few types in a special way
This commit is contained in:
parent
bb5503b147
commit
5fd5de9fb8
@ -35,13 +35,26 @@ class Sum extends NullableAggregateUnaryOp { // OPENJPA-1794
|
|||||||
super(val);
|
super(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* As per spec section 4.8.5 Aggregate Functions in the SELECT Clause we
|
||||||
|
* need to handle a few types in a special way.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Class getType(Class c) {
|
protected Class getType(Class c) {
|
||||||
Class wrap = Filters.wrap(c);
|
if (c == Integer.class ||
|
||||||
if (wrap == Integer.class
|
c == int.class ||
|
||||||
|| wrap == Short.class
|
c == Short.class ||
|
||||||
|| wrap == Byte.class)
|
c == short.class ||
|
||||||
return long.class;
|
c == Byte.class ||
|
||||||
|
c == byte.class) {
|
||||||
|
return Long.class;
|
||||||
|
}
|
||||||
|
if (c == Float.class ||
|
||||||
|
c == float.class ||
|
||||||
|
c == Double.class ||
|
||||||
|
c == double.class ) {
|
||||||
|
return Double.class;
|
||||||
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user