开发者

PageListView and dataset loading

The dataset I display using Pag开发者_JAVA技巧eableListView 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?


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜