语句如下:from CustomerGroup group where 1=1 and ( group.oper = '0' or group.oper = 'super' ) order by group.createTime DESC
报错:org.hibernate.hql.ast.QuerySyntaxException: expecting "by", found '.' near line 1, column 84 [ from com.XXXXXXXXX.hibernate.persistent.CustomerGroup group where 1=1 and ( group.oper = '0' or group.oper = 'super' ) order by group.createTime DESC]
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:31)
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:24)
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:258)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
我试着把括号里面的group.去掉,语句改为from CustomerGroup group where 1=1 and ( oper = '0' or oper = 'super' ) order by group.createTime DESC就没问题了,这是什么原因,hibernate怎么处理括号的
报错:org.hibernate.hql.ast.QuerySyntaxException: expecting "by", found '.' near line 1, column 84 [ from com.XXXXXXXXX.hibernate.persistent.CustomerGroup group where 1=1 and ( group.oper = '0' or group.oper = 'super' ) order by group.createTime DESC]
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:31)
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:24)
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:258)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
我试着把括号里面的group.去掉,语句改为from CustomerGroup group where 1=1 and ( oper = '0' or oper = 'super' ) order by group.createTime DESC就没问题了,这是什么原因,hibernate怎么处理括号的
解决方案 »
- JAVA后加'$'符号是指什么?
- 今天无意中看到公司给别人出的面试题
- 关于附件的加解密的问题
- java编译问题
- 数据库字符集是us7ascii,websphere的jvm是gbk,页面的编码是gbk
- 严重: Exception starting filter opensession!·!!!!! 100分
- 初学JSF 请大家介绍一些教材
- 在线急等:jstl "package org.apache.taglibs.standard.tag.rt.core does not exist"
- 求教Hibernate中xml配置文件字段数据类型错误
- //xml解析问题!!!简单的分。
- 奇怪的getParameter问题
- 如何在sqlserver 2005中将bak文件还原为数据库文件
<property name="generate_statistics">true</property>