There are two methods of the Criteria interface for pagination.
Using above two methods together, we can construct a paging component in our web or Swing application. Following is the example which you can extend to fetch 10 rows at a time:
Criteria cr =session.createCriteria(Employee.class);
cr.setFirstResult(1); cr.setMaxResults(10); List results =cr.list(); |