public class MyEntityPaginationTest {
public void testPagination_Hibernate4() {
getResultList(0, 2); getResultList(2, 2); }
public void testPagination_Hibernate5() {
getResultList(0, 2); getResultList(2, 2); }
public List<MyEntity> getResultList(int firstResult, int maxResults) {
return getEntityManager().createNamedQuery(
"MyEntity.getAll", MyEntity.class)
.setFirstResult(firstResult)
.setMaxResults(maxResults)
.getResultList();
}
}