我是靠谱客的博主 害怕冰棍,这篇文章主要介绍unexpected token: * near line 1, column 8 [select * from t_one_buy where 1=1 order by create_date de,现在分享给大家,希望可以做个参考。

org.hibernate.hql.ast.QuerySyntaxException: unexpected token: * near line 1, column 8 [select * from t_one_buy where 1=1 order by create_date desc]

hibernate 报这个sql语句出错,看了下,这个sql并没有问题

根着代码到dao层,发现在 在hibernate里面写sql执行时候要用了session.createQuery(sql); 这个是需要Hql语言的,需要换成getSession().createSQLQuery(sql)的。所以在用Hibernate操作数据库时要注意到Hql还是普通sql.

Hibernate是用操作数据对象代替操作表,给程序员的感觉是面向对象操作数据库。所以查询语句from后面接的不是表名称,而是javabean数据对象名。



最后

以上就是害怕冰棍最近收集整理的关于unexpected token: * near line 1, column 8 [select * from t_one_buy where 1=1 order by create_date de的全部内容,更多相关unexpected内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(65)

评论列表共有 0 条评论

立即
投稿
返回
顶部