During all my development practice with JSF time to time issue with large data tables arises - how to fetch the data on demand and to not load the whole RecordSet to memory?
When I started to use ADF Faces with ADF BC problem dissapered, however there are still projects where we use just ADF Faces part (now MyFaces Trinidad) and there are no out-of-the-box solution to fetch the data on demand.
Recently I found one example, which is describing the solution to use with classic JSF DatModel, on MyFaces wiki site - http://wiki.apache.org/myfaces/WorkingWithLargeTables.
I have adopted this example to be more universal and to work with ADF Faces table sorting and paging.
Example consists of three classes -
CollectionModel
implementation,
DataPage
, and data fetch listener interface which should be implemented in the model binding/service layer.
Whenever new page is needed, listener will be called.
There is also one additional interface
Identifiable
which is used to better leverage ADF Table rowKey conception. This interface could be implemented by the Entity class (single table row) in order to provide rowKey to the ADF Table.
You can download complete example JDeveloper workspace from here:
DataOnDemandExample.zipUpdate: Broken link has been fixed.To use the example you will need to setup MyFaces Trinidad 1.0.X libraries.