mysql+hibernate+分页
转自:http://hi.baidu.com/streamlinlin/item/a29d99d69251a4cc1b72b412
在HQL+MYSQL中不能直接在查询语句中使用LIMIT进行检索,正确方法为:
Query query = session.createQuery(hql);
query.setFirstResult(pageroffset);
query.setMaxResults(e);
pageroffset:开始检索的位置,int
e:返回最大记录行,int
执行此HQL后在生成的查询语句中会自动加上limit ?。
猜你喜欢
转载自wojiaofeiji.iteye.com/blog/2275443
今日推荐
周排行