mirror of https://github.com/apache/openjpa.git
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
protected Class getType(Class c) {
|
||||
Class wrap = Filters.wrap(c);
|
||||
if (wrap == Integer.class
|
||||
|| wrap == Short.class
|
||||
|| wrap == Byte.class)
|
||||
return long.class;
|
||||
if (c == Integer.class ||
|
||||
c == int.class ||
|
||||
c == Short.class ||
|
||||
c == short.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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue