首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

哪位高手能帮小弟我转换上HQL语句弄了一早下就是报错.

2012-12-23 
谁能帮我转换下HQL语句弄了一早上就是报错....select stu.stuid,stu.stuname,round(avg(sco.score),2) avg

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

热点排行