2个回答
展开全部
以下2个函数扰握培可实现分页。皮则
Query q = session.createQuery(hql);
q.setFirstResult(0);
q.setMaxResults(8);
--------------------------------------------------------
public List<缓唯Book> getNewBookList()
{
Session session = HibernateSessionFactory.getSession();
Transaction tx = session.beginTransaction();
tx.begin();
String hql = " from com.tarena.dangdang.entity.Book where state = 1 order by indate desc";
Query q = session.createQuery(hql);
q.setFirstResult(0);
q.setMaxResults(8);
List<Book> list = q.list();
tx.commit();
session.close();
return list;
}
Query q = session.createQuery(hql);
q.setFirstResult(0);
q.setMaxResults(8);
--------------------------------------------------------
public List<缓唯Book> getNewBookList()
{
Session session = HibernateSessionFactory.getSession();
Transaction tx = session.beginTransaction();
tx.begin();
String hql = " from com.tarena.dangdang.entity.Book where state = 1 order by indate desc";
Query q = session.createQuery(hql);
q.setFirstResult(0);
q.setMaxResults(8);
List<Book> list = q.list();
tx.commit();
session.close();
return list;
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询