读书人

哪位高手能帮小弟我转换上HQL语句弄了

发布时间: 2012-12-23 11:28:15 作者: rapoo

谁能帮我转换下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看行不行,根据你的描述来看的话,就是这个问题导致的。

读书人网 >Java Web开发

热点推荐