I have to display rows from the database table on the UI. So, lets say we have 200 rows in the table. So , my first hit will give me first 20 rows. Now, i want to fetch next 20 rows in the next hit. I am using Hibernate for handling database CRUD operations.
query.setMaxResults(int size) works fine for first hit .But how to handle transactions for 2nd and onwards hits ?
Query
- a particular page of the result set may be selected by calling setMaxResults(), setFirstResult().
see http://docs.jboss.org/hibernate/orm/3.6/javadocs/org/hibernate/Query.html