I am having rich:datatable having 500(row) data and I am using rich:datascroller for pagination but the problem is all the data are fetched on 1st time, so if anybody having a way that click on page 2 hibernate fetches rows from table (11-20). I am using Spring+Hibernate. Please Give solution in detail.
+1
A:
You'd need a custom data model and a custom data provider. The Data provider will take care of fetching limited results, using query.setMaxResults(..)
. Note that since you are using spring, it would be good if your DataProvider
instance is spring-managed.
Here is some code that we used for that purpose.
Bozho
2010-10-01 07:35:05
Ya bozho spring manages hibernate. I m not getting from the Solution given by the link. I can use Projection for rowCount() ? . But then also i m lil bit confused....
taher
2010-10-01 08:20:11
@taher - you can use whatever you like in your `DataProvider` implementation. Just copy the data model, and create a new `DataProvider` implementation. Its methods are straightforward to implement.
Bozho
2010-10-01 08:28:14