1.
return getHibernateTemplate().executeFind(new HibernateCallback() {
public Object doInHibernate(Session s) throws HibernateException {
Criteria c = s.createCriteria(AskOnline.class);
c.add(Restrictions.eq("boardid", new Long(bid)));
c.setFirstResult(spage);
c.setMaxResults(perPageNum);
return c.list();
}
});
2.
final String hql ="from AskOnline a where a.boardid=? and a.isreply = 0 order by a.id desc";
return getHibernateTemplate().executeFind(new HibernateCallback() {
public Object doInHibernate(Session s) throws HibernateException, SQLException {
Query query = s.createQuery(hql);
query.setLong(0, bid);
query.setFirstResult(spage);
query.setMaxResults(perPageNum);
List list = query.list();
return list;
}
});