hql查询 could not execute query错误提示:org.hibernate.exception.SQLGrammarException:could not execute queryorg.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExc

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/07 05:14:11

hql查询 could not execute query错误提示:org.hibernate.exception.SQLGrammarException:could not execute queryorg.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExc
hql查询 could not execute query
错误提示:
org.hibernate.exception.SQLGrammarException:could not execute query
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.loader.Loader.doList(Loader.java:2223)
org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
org.hibernate.loader.Loader.list(Loader.java:2099)
org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
wyf.zrk.DButil.getInfo(DButil.java:21)
wyf.zrk.ManageServlet.doPost(ManageServlet.java:45)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
我把hql语句打印出来是这样的
from AdminInfo as p where p.aname='zrk' and p.apwd='12345'(这里的zrk和12345都是获取到的 打印出来就显示了这样的了 )
Hibernate:select admininfo0_.aid as aid0_,admininfo0_.'aname' as column2_0_,admininfo0_.'apwd' as column3_0_,admininfo0_.'alevel' as column4_0_ from AdminInfo admininfo0_ where admininfo0_.'aname'='zrk' and admininfo0_.'apwd'='12345'
严重:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''aname' as column2_0_,admininfo0_.'apwd' as column3_0_,admininfo0_.'alevel' as' at line 1
回复一楼 你说的两条我都检查了 都是对的 我还把表drop了 然后重建的表 还是不行

hql查询 could not execute query错误提示:org.hibernate.exception.SQLGrammarException:could not execute queryorg.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExc
严重:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''aname' as column2_0_,admininfo0_.'apwd' as column3_0_,admininfo0_.'alevel' as' at line 1
第一:你确定你的实体名称Admininfo写对了,还有aname和apwd也写对了,aname和spwd也对应是实体Admininfo 的属性名称.
第二:如果以上确定没有错误的话,可以肯定的是你的实体映射有问题,映射文件里的实体属性名称要与你的表的列名要对应上,仔细研究上面的错误,问题很有可能出在表的列上.