Пример #1
0
  public Page<T> findPage(Page<T> page, Criterion[] criterions) {
    AssertUtils.notNull(page, "page不能为空");

    Criteria c = createCriteria(criterions);

    long totalCount = countCriteriaResult(c);
    page.setTotalItems(totalCount);

    setPageParameterToCriteria(c, page);

    List result = c.list();
    page.setResult(result);
    return page;
  }
Пример #2
0
  public Page<T> findPage(Page<T> page, String hql, Map<String, ?> values) {
    AssertUtils.notNull(page, "page不能为空");

    Query q = createQuery(hql, values);

    long totalCount = countHqlResult(hql, values);
    page.setTotalItems(totalCount);

    setPageParameterToQuery(q, page);

    List result = q.list();
    page.setResult(result);
    return page;
  }