jack182 wrote:
..can someone help me to do a pagination with stuts framework combine with hibernate...thanks a lot.
Hi...
From the point of view of Hibernate, you may paginate the data in this way:
suppose you must query for the first page of data, composed of 30 objects.
You may do something of :
Code:
Query query = currentSession.createQuery("from User u");
query.setFirstResult(0);
query.setMaxResults(NUMBER_OF_ELEMENTS_PER_PAGE);
List users = query.list();
In this case we are supposing the first page is composed of 10 elements.
Now we wish to load the second page (of 10 elemens too).
Code:
Query query = currentSession.createQuery("from User u");
query.setFirstResult(10);
query.setMaxResults(NUMBER_OF_ELEMENTS_PER_PAGE);
List users = query.list();
...and so on.
By(te)
-
Pleas don't forget to credit ,-)