67,512
社区成员
发帖
与我相关
我的任务
分享
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;
}
});