HQL语句里面不能加括号? 没加之前是对的select entry.cellAddress from com.fuhe.yjh1104.dbaccess.dao.EntryConversionFunction entry  where entry.standReportId = 1277 and entry.entryConversionFunction like '%A3302%33370%' and entry.cellAddress like '%C%' or entry.cellAddress like '%D%' order by entry.reportContentDefinition.id,但是sql不对满足不了要求,现在加了直接hql: select entry.cellAddress from com.fuhe.yjh1104.dbaccess.dao.EntryConversionFunction entry  where entry.standReportId = 1277 and entry.entryConversionFunction like '%A3302%33370%' and (entry.cellAddress like '%C%' or entry.cellAddress like '%D%')order by entry.reportContentDefinition.id 都不对了,请问下该怎么弄,谢谢。
org.springframework.orm.hibernate3.HibernateQueryException: unexpected char: 0xA3 [ select entry.cellAddress from com.fuhe.yjh1104.dbaccess.dao.EntryConversionFunction entry  where entry.standReportId = 1277 and entry.entryConversionFunction like '%A3302%33370%' and (entry.cellAddress like '%C%' or entry.cellAddress like '%D%')order by entry.reportContentDefinition.id]; nested exception is org.hibernate.QueryException: unexpected char: 0xA3 [ select entry.cellAddress from com.fuhe.yjh1104.dbaccess.dao.EntryConversionFunction entry  where entry.standReportId = 1277 and entry.entryConversionFunction like '%A3302%33370%' and (entry.cellAddress like '%C%' or entry.cellAddress like '%D%')order by entry.reportContentDefinition.id]
org.hibernate.QueryException: unexpected char: 0xA3 [ select entry.cellAddress from com.fuhe.yjh1104.dbaccess.dao.EntryConversionFunction entry  where entry.standReportId = 1277 and entry.entryConversionFunction like '%A3302%33370%' and (entry.cellAddress like '%C%' or entry.cellAddress like '%D%')order by entry.reportContentDefinition.id]
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:165)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:834)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)hqlexception

解决方案 »

  1.   

    hql能加(),是其他原因吗,没有()时会报错吗?
      

  2.   

    org.hibernate.QueryException: unexpected char: 0xA3 [ select entry.cellAddress from com.fuhe.yjh1104.dbaccess.dao.EntryConversionFunction entry  where entry.standReportId = 1277 and entry.entryConversionFunction like '%A3302%33370%' and (entry.cellAddress like '%C%' or entry.cellAddress like '%D%')order by entry.reportContentDefinition.id]
    难道说是中文括号'('的原因么?
      

  3.   

    and (entry.cellAddress这里的括号是中文的吧