日期:2014-05-17  浏览次数:20581 次

谁能帮我转换下HQL语句弄了一早上就是报错....
select stu.stuid,stu.stuname,round(avg(sco.score),2) avgscore,sum(sco.score) 
          sumscore from scores sco inner join students stu on stu.stuid=sco.stuid  
          group by stu.stuid,stu.stuname order by sumscore desc

------解决方案--------------------
引用:
引用:引用:引用:你的hibernate的查询方法肯定是用的HQL查询方式,是不是?
因为你写的是sql语句,所以会报错,hibernate的HQL查询的结果是以对象方式来存在的,不能查属性,你写的
select stu.stuid,stu.stuname,roun……

你先试试把createQuery方法换成createSQLQuery看行不行,根据你的描述来看的话,就是这个问题导致的。