程序如下:
whereSQL="and t.deptid=000029"
public List listJxglType(String whereSQL) {
String hql = " from XtJxglType t where 1=1  "+whereSQL;
if(whereSQL==null|| "".equals(whereSQL))
hql = " from XtJxglType t ";
List list = xtJxglZykhDAO.find(hql);
return list;
}
public List find(String hql) {
Assert.hasLength(hql);
return getHibernateTemplate().find(hql);-------这里报错抛出异常!!!
}后台错误信息:<ERROR>(ErrorCounter.java:33) - line 1:70: unexpected token: 9前台页面错误信息:错误提示 
 
 出现未知异常!org.springframework.orm.hibernate3.HibernateQueryException: unexpected token: 9 near line 1, column 70 [ from com.nbw.jxgl.domain.XtJxglType t where 1=1 and t.deptid=000029]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: unexpected token: 9 near line 1, column 70 [ from com.nbw.jxgl.domain.XtJxglType t where 1=1 and t.deptid=000029]  

解决方案 »

  1.   

    HQL没有问题!
    你是不是整合SSH出的问题?
    很有可能是jar包冲突哦
      

  2.   

    这里可以去看一下
    http://gdljg0460.javaeye.com/blog/272216
      

  3.   

    t.deptid=000029 000029 这个值是否改用'000029'?
      

  4.   

    t.deptid这个是部门ID,我如果换成其它部门ID的话,就没有错了。
    关键是只有000029这个部门ID时才报错!晕死……
      

  5.   

    if(whereSQL==null|| "".equals(whereSQL))这能进得去吗?FALSE || FALSE = FALSE
      

  6.   

    建议, 将deptid用单引号括起来,毕竟不是整型啊。
    其他没有报错的deptid有哪些呢? 
    ---------------------------
    细粒度权限管理软件 试用版下载
    www.metadmin.com