2 Replies Latest reply on Jul 23, 2009 2:58 PM by Jay Balunas

    Lazy loading with Rich datatable and datascroller

    Benny Bottema Newbie

      Hey guys,

      Recently I was looking for a solution to the common lazy loading problem in datatables and datascrollers. I found that in JSF land, there aren't many solutions, no clear cut solution, and no elegant alternatives... or so my investigation indicated.

      I've encountered some attempts of integrating JSF specific solutions (extended datamodel, extended datatable etc.) as well as the infamous OpenSessionInView pattern where you keep a Hibernate-like session open in the view, lazily fetching data as required. These (vendor-specific) solutions seemed either too complex or too fragile.

      I thought I'd share my solution as well.

      My rationale: circumvent everything by simply implementing a transparent paging mechanism into a generic Java List. Similar to Apache's lazy list, except smarter... yet simpler, just take a look at the code yourselves.

      I've written a blogpost about it with a example implementation for JSF views and JPA dao's. But it might as well work with JMS queue or other type of data accessors.


      Just let me know what you think.