hibernate中的hql语句报错。
sql语句是selectscore.sno,cno,class,ascore,bscore,sumscorefromscore,studentwherestudent.s...
sql语句是
select score.sno,cno,class,ascore,bscore,sumscore
from score,student
where student.sno=score.sno
order by class ASC
能够执行,换成Hql语句应该怎么换??已经将表的名字改成大写了。
错误是:
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: , near line 1, column 21 [select Score.sno,cno,class,ascore,bscore,sumscore from Dao.Score,Dao.Student where (Student.sno=Score.sno) order by class ASC] 展开
select score.sno,cno,class,ascore,bscore,sumscore
from score,student
where student.sno=score.sno
order by class ASC
能够执行,换成Hql语句应该怎么换??已经将表的名字改成大写了。
错误是:
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: , near line 1, column 21 [select Score.sno,cno,class,ascore,bscore,sumscore from Dao.Score,Dao.Student where (Student.sno=Score.sno) order by class ASC] 展开
展开全部
为每个表加上别名,所有属性都通过别名来引用,另外class这个关键字可能冲突。
大概是这样,注意对比实体类的属性。
select a.sno,a.cno,a.class,a.ascore,a.bscore,a.sumscore
from Dao.Score a,Dao.Student b
where (a.sno=b.sno) order by a.class ASC
大概是这样,注意对比实体类的属性。
select a.sno,a.cno,a.class,a.ascore,a.bscore,a.sumscore
from Dao.Score a,Dao.Student b
where (a.sno=b.sno) order by a.class ASC
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询