1. 程式人生 > >daoImpl裡呼叫getSession(),hibernate DetachedCriteria Criteria進行分頁查詢

daoImpl裡呼叫getSession(),hibernate DetachedCriteria Criteria進行分頁查詢

DaoImpl裡呼叫getSession()

public class SocialInfoDaoImpl extends BaseDaoImpl<SocialInfo,Integer> implements ISocialInfoDao { public List findByConditionPage(DetachedCriteria criteria,int pageNo, int pageSize) { List list = new ArrayList(); Criteria c = criteria.getExecutableCriteria(this.getSession().getSessionFactory().getCurrentSession()); // 執行分頁,並返回查詢結果 list= c.setProjection(null).setFirstResult((pageNo - 1) * pageSize).setMaxResults(pageSize).list(); return list; } } 看帖處1:

https://blog.csdn.net/qq_29663071/article/details/51997312 看帖處2:https://www.cnblogs.com/mannixiang/p/6610138.html