Hi all ,
I am getting a strange issue in Hibernate and i hope someone can help me resolve it. It may be because i am still new to Hibernate, but i do need a little nudge.
Basically what is happening is that the query that is provide to Hibernate for execution changes automatically. Here is a dummied down example
Input HQL: SELECT SUM(A.AMOUNT) FROM TABLEA A, TABLEB B WHERE TABLEA.ID=TABLEB.ID AND TABLEA.NAME= 'XYZ'
Now what I am expecting out of this query is only a single Object which i can easily typecast into a integer. But what i observed was that the query was being translated into the following by Hibernate.
Output HQL: SELECT A.NAME,A.AMOUNT,A.COL2,B.COL1,B.COL2,BB.COL3 FROM TABLEA A, TABLEB B WHERE TABLEA.ID=TABLEB.ID AND TABLEA.NAME= 'XYZ'
So basically what i getting is the entire row is the result set. when i expecting only the sum.
Hoping somebody can help here.