Please forgive me if i have posted this post it in the wrong place.
I have a problem with
sum function (data calculation).
My lucky guess is that the column in the db is type "Short" while the sum returns greater than Short. Is this correct? Do i have to change the columns to "Long" to get back a big number? My DB is Oracle9i, jdk 1.4, Hibernate 3.1
I am using the following code that works:
Code:
String prq = "SELECT sum(b.purchaseAttempts) FROM BannerTracking b WHERE b.bannerId IS NOT NULL AND b.creationDate >= :fromDate AND b.creationDate < :toDate";
int ipr = 0;
Iterator iter = s.createQuery(prq)
.setDate("fromDate", dateFrom)
.setDate("toDate", dateTo)
.iterate();
if(iter != null){
Short mysh = (Short)iter.next();
if(mysh != null){
ipr = mysh.intValue();
}
}
BUT Works 5 out of 6.
The last loop the following exception is thrown:
Please redirect me if the answer exists already. I tried to search but i didn't manage to find a solution.
The exception is:
DEBUG: could not execute query using iterate
org.hibernate.exception.GenericJDBCException: could not execute query using iterate
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)