hibernate分页

public List<Content> findByPage(String hql, int start, int limit) {
Query q=getSession().createQuery(hql);
q.setFirstResult(start);
q.setMaxResults(limit);
List<Content> contents=(List<Content>)q.list();
return contents;
}

Query q=getSession().createQuery("from Content c where c.head.doccode=:doccode");
q.setString("doccode", doccode);
q.setFirstResult(start);
q.setMaxResults(limit);

你可能感兴趣的:(C++,c,Hibernate,C#)