使用hql使用order by子句出现异常和数据异常的解决办法org.hibernate.hql.internal.ast.QuerySyntaxException
来源:互联网 发布:日本电影 知乎 编辑:程序博客网 时间:2024/05/17 16:46
org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token:
今天合作开发一个小型电影推荐系统的时候发现一个问题,我负责编写电影评论部分,在从数据库返回list时,我的list应该是可以排序的,普通评论会按照time属性进行排序,所以在检索的时候,我的hql语句是这样的(orderby子句放在后边)
String hql = "from Comment comment where comment.movieid = "+ movieid + " order by comment.time desc";
这样是对的,但是我开始的时候hql语句是下边这样的
String hql = "from Comment comment order by comment.time desc where comment.movieid = "+ movieid;
请忽略一些博客编写可能产生的空格问题,我在写的时候把order by子句放在了where前边,于是乎console就抛出了异常,还有一个一起开发的同学,也是吧orderby子句放在前边,他没有出现异常,但是数据提取是错的,至于原因不太清楚,今天问下实习部门领导,晚点会有更新。
ps:超级鄙视博客里随意粘贴复制的人,负点责任好吗!
0 0
- 使用hql使用order by子句出现异常和数据异常的解决办法org.hibernate.hql.internal.ast.QuerySyntaxException
- org.hibernate.hql.ast.QuerySyntaxException 异常处理
- org.hibernate.hql.ast.QuerySyntaxException异常处理
- org.hibernate.hql.internal.ast.QuerySyntaxException
- Hibernate的org.hibernate.hql.internal.ast.tree.PathNode异常
- 使用hibernate的hql语句做查询报错 org.hibernate.hql.internal.ast.QuerySyntaxException: user is not mapped
- myeclipse 使用weblogic10启动hibernate项目时出现ClassNotFoundException: org.hibernate.hql.ast.HqlToken异常的解决办法
- 异常收集-org.hibernate.hql.internal.ast.QuerySyntaxException: activityinfo is not mapped
- org.hibernate.hql.internal.ast.QuerySyntaxException其中一种的解决方案
- org.hibernate.hql.ast.QuerySyntaxException: is not mapped 异常总结
- org.hibernate.hql.ast.QuerySyntaxException: is not mapped 异常总结 .
- org.hibernate.hql.ast.QuerySyntaxException is not mapped异常
- org.hibernate.hql.ast.QuerySyntaxException: **** is not mapped 异常总结
- org.hibernate.hql.ast.QuerySyntaxException:is not mapped 异常总结
- org.hibernate.hql.ast.QuerySyntaxException: is not mapped 异常总结
- org.hibernate.hql.ast.QuerySyntaxException:is not mapped 异常总结
- org.hibernate.hql.ast.QuerySyntaxException:is not mapped 异常总结
- org.hibernate.hql.ast.QuerySyntaxException: is not mapped 异常总结
- Apache Mahout:适合所有人的可扩展机器学习框架
- N皇后问题c语言解法
- 【总结】 后缀数组
- POJ 1028 Web Navigation
- GDataXML解析XML
- 使用hql使用order by子句出现异常和数据异常的解决办法org.hibernate.hql.internal.ast.QuerySyntaxException
- 学习C语言要具备两种态度
- wikioi 1283 等差子序列(bitset 01位的巧妙使用)
- 最近很忙,现在很闲。。。
- strpbrk 函数
- C语言中->含义
- POJ 3278 简单广搜
- 二叉树遍历
- eclipse安装maven插件及从svn检出项目时没有check out as maven project选项解决方法