There are two methods of the Query 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:
String hql ="FROM Employee";
Query query =session.createQuery(hql); query.setFirstResult(1); query.setMaxResults(10); List results =query.list(); |