给query设置参数的时候,因为我传入的是final object,最后执行query.uniqueResult()的时候类型转换错误,这个怎么解决...
public PageModel searchPaginated(final String hql, final int offset,
final int pagesize, final Object... params) throws IOException {
PageModel pm = new PageModel();
final String countHql = getCountQuery(hql);
List list = executeFind(new HibernateCallback() {
public Object doInHibernate(Session session)
throws HibernateException, SQLException {
Query query = session.createQuery(countHql);
if (params != null) {
for (int i = 0; i < params.length; i++){
query.setParameter(i, params[i]);
}
}
List list = new ArrayList();
list.add(query.uniqueResult());
return list;
}
});