views:

26

answers:

1

The dataset I display using PageableListView can get very big and keeping the whole dataset as a model would be very inefficient. Is it possible to load for example only the set of IDs first and then load only the objects that are to be displayed on the current page? I use Wicket+Spring+Hibernate/JPA. Or is there a better approach to paging in this case?

+2  A: 

The usual way to deal with that (at least for me) would be to perform:

  • a first query to count the items and deduce the number of pages to display
  • subsequent queries using Query#setFirstResult(int) and Query#setMaxResults(int) for each page.

In Wicket, JPA, GlassFish and Java Derby or MySQL, the author shows precisely how to implement this approach using Wicket and a DataView instead of PageableListView (sample code provided).

Pascal Thivent
+1: Basically the answer is to use DataView instead of PageableListView, but this blog entry indeed explains it well.
Don Roby
@Don Thanks Don, you're right and I've clarified this point in my answer.
Pascal Thivent