2013年9月17日星期二

Great God come to see : HQL Why not add brackets ?

HQL statement which can not be bracketed ? did not increase until right 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, but sql does not meet the requirements , now added a direct 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 not right , and ask how to get down , thank you.
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)
------ Solution ------------------ --------------------------
hql can add ( ) , other reasons for it , there is no ( ) error when you ?
------ Solution ---------------------------------------- ----
and (entry.cellAddress where the parentheses are Chinese , right
------ For reference only ------------------ ---------------------
wood have big god na
------ For reference only --------- ------------------------------
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]
Could it be that the Chinese parenthesis ' ( ' Cause what ?
------ For reference only ---------------------------------------
Great God !

没有评论:

发表评论