expecting IDENT錯誤解決辦法
(2010-11-09 16:16:41)

轉載▼
标簽: it | 分類: ThinkInJava |
今天的開發爆出如下錯誤。
org.hibernate.hql.ast.QuerySyntaxException: expecting IDENT, found '*' near line 1, column 10 [select a.* from com.jyzq.hr.bean.Archive a,com.jyzq.hr.bean.Employee e,com.jyzq.hr.bean.Department d where a.contractEndDate = :date and a.status = 'A' and a.empId = e.id and e.status = 'A' and e.type = 'A' and e.deptid=d.id and d.type='A']
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:31)
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:24)
at org.hi
原因是hql語句報錯。
hql:select a.* from Archive a,Employee e,Department d where a.contractEndDate = :date and a.status = 'A' and a.empId = e.id and e.status = 'A' and e.type = 'A'
把hql改為如下形式,則編譯通過。一切正常
select a from Archive a,Employee e,Department d where a.contractEndDate = :date and a.status = 'A' and a.empId = e.id and e.status = 'A' and e.type = 'A'
select 後面為對象 a .而非 a.*