关于SSH2的访问数据库问题。
public int findNumByCondition(Map<String,String> map) throws Exception {
String hql="";
hql += "from EAqInsAfamanageillegal536 where isdeleted = 0";
hql += createHql(map);
return this.findWhereCount(hql);
}
本人使用此方法、map为传递的所有参数,我另写了一个方法进行动态拼接。 现在出现的问题是: 对有些参数调用没有问题。而有些却报了如下的错误:
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: 9 near line 1, column 130 [from com.Achilles.entity.common.EAqInsFandmanageillegal534 where isdeleted = 0 and reportyear =2013 and to_number(reportmonth) =09 and reporttype =1 and QCmnOperatepoint20.operatepointid =153]
我的SQL执行没有问题; to_number(reportmonth)==01 或者02等等 没有问题,唯独09 或者08 执行此查询的时候报错。请高手指点!!!本人使用的是mysql数据库