public List queryByStatus(int status, int currentPage, int lineSize)
throws Exception {
List all = null;
String hql = "FROM Question AS q WHERE q.status=? ORDER BY q.questiontime desc";
Query q = super.getSession().createQuery(hql);
q.setInteger(0, status);
q.setFirstResult((currentPage - 1) * lineSize);
q.setMaxResults(lineSize);
all = q.list();
return all;
}
|