org.springframework.orm.hibernate3.HibernateQueryException: addEntity() or addScalar() must be called on a sql query before executing the query. [select sum(psta) from Apostpd as apostpd inner join Apostpdadd as apostpdadd on apostpd.id=apostpdadd.apostpdId where apostpd.cnum=:cnum and apostpd.drcr=:drcr and apostpd.ccy=:ccy and apostpd.vald between :inputDate and :date and apostpdadd.opLins=:opLins]; nested exception is org.hibernate.QueryException: addEntity() or addScalar() must be called on a sql query before executing the query. [select sum(psta) from Apostpd as apostpd inner join Apostpdadd as apostpdadd on apostpd.id=apostpdadd.apostpdId where apostpd.cnum=:cnum and apostpd.drcr=:drcr and apostpd.ccy=:ccy and apostpd.vald between :inputDate and :date and apostpdadd.opLins=:opLins] Caused by: org.hibernate.QueryException: addEntity() or addScalar() must be called on a sql query before executing the query. [select sum(psta) from Apostpd as apostpd inner join Apostpdadd as apostpdadd on apostpd.id=apostpdadd.apostpdId where apostpd.cnum=:cnum and apostpd.drcr=:drcr and apostpd.ccy=:ccy and apostpd.vald between :inputDate and :date and apostpdadd.opLins=:opLins] at org.hibernate.impl.SQLQueryImpl.verifyParameters(SQLQueryImpl.java:169)