@Override
  public <T> Page<T> getPage(Class<T> clazz, Criteria criteria, Pageable pageable) {
    Criteria countCriteria = HibernateTool.copyCriteria(criteria);
    long totalItemCount = count(countCriteria);

    List<T> items =
        find(
            clazz,
            criteria,
            pageable.getPageNumber() * pageable.getPageSize(),
            pageable.getPageSize(),
            CriteriaTool.toOrders(pageable.getSort()).toArray(new Order[0]));
    return new PageImpl<T>(items, pageable, totalItemCount);
  }
 @Override
 public <T> List<T> getIn(Class<T> clazz, Serializable[] ids) {
   DetachedCriteria dc = CriteriaTool.addIn(DetachedCriteria.forClass(clazz), "id", ids);
   return find(clazz, dc);
 }