org.hibernate.hql.ast.QuerySyntaxException求高人指教我执行了一条SQLselect po from com.forgon.cs.onlinepreparation.question.model.Question as po where difficultyValue = '' and typeForDisplay = '' order by dbms_random.value然后hibernate内

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/25 20:27:54
org.hibernate.hql.ast.QuerySyntaxException求高人指教我执行了一条SQLselect po from com.forgon.cs.onlinepreparation.question.model.Question as po where difficultyValue = '' and typeForDisplay = '' order by dbms_random.value然后hibernate内

org.hibernate.hql.ast.QuerySyntaxException求高人指教我执行了一条SQLselect po from com.forgon.cs.onlinepreparation.question.model.Question as po where difficultyValue = '' and typeForDisplay = '' order by dbms_random.value然后hibernate内
org.hibernate.hql.ast.QuerySyntaxException求高人指教
我执行了一条SQL
select po from com.forgon.cs.onlinepreparation.question.model.Question as po where difficultyValue = '' and typeForDisplay = '' order by dbms_random.value
然后hibernate内就抛出了异常
org.hibernate.hql.ast.QuerySyntaxException: Invalid path: 'dbms_random.value' [
应该是hibernate把dbms_random.value当成了这个表的属性所以报错,不知道有没人知道怎样做可以不用去遍历resultset而直接得到绑定到对象里的结果

org.hibernate.hql.ast.QuerySyntaxException求高人指教我执行了一条SQLselect po from com.forgon.cs.onlinepreparation.question.model.Question as po where difficultyValue = '' and typeForDisplay = '' order by dbms_random.value然后hibernate内
既然你用的是HQL查询的话,那就不能用ORACLE的函数“ dbms_random.value”进行随机排序啊;个人觉得,你要实现随机排序的功能的话,不如就换成SQL查询,感觉还要方便些;