Esempio n. 1
0
  public <E extends BaseEntity> List<E> findWithPaging(
      String ql, int maxResults, int firstResult, Object... args) {
    Query query = createQuery(ql, args);
    query.setMaxResults(maxResults).setFirstResult(firstResult);

    @SuppressWarnings("unchecked")
    List<E> resultList = query.getResultList();
    return resultList;
  }
 public static List getCustomers(EntityManager entityManager, int max, int index) {
   Query query = entityManager.createQuery("from Customer c");
   return query.setMaxResults(max).setFirstResult(index).getResultList();
 }