title: Primefaces Lazyload + datatable + lazyDataModel
body: <p>I did my research, found many problems with <code>lazyload</code> and dataTable, but none explains the problem I'm having. I actually already posted this problem on Primefaces website and got no answers. Either my problem is too stupid or too complex.</p>
  
  <p>We updated our primefaces library from 3.1.1 to 3.5, and our <code>LazyLoad</code> datatables stopped working. Basically the DataModel has changed, so I implemented a new one based on Primefaces Showcase scenario.</p>
  
  <blockquote>
    <p>The error is: java.lang.UnsupportedOperationException: Lazy loading is
    not implemented.</p>
  </blockquote>
  
  <p>The thing is it is implemented by the class <code>LazyMethodDataModel</code> as you see the code below.
  When I debug, the constructor is called but the error is throwed before the load method is called. </p>
  
  <p>Any thoughts? thank you in advance. Should you need more information, please let me know.</p>
  
  <pre><code> public class LazyMethodDataModel_new extends LazyDataModel&lt;Produto&gt; {
  @Override
  public List&lt;Produto&gt; load(int first, int pageSize, List multiSortMeta, Map filters) { 
     generic.setRow(first);
     generic.setPage(pageSize);
    List objts = (List) Reflection.getObjectByInvokeMethod(crud, method, generic);
     return objts;
  
  }
  public LazyMethodDataModel_new(CrudFacade crud,String method,String   methodCount,GenericModel&lt;?&gt; generic) {
  
      this.crud = crud;
      this.generic = generic;        
      this.method = method;        
      size = (Integer) Reflection.getObjectByInvokeMethod(crud, methodCount, generic);
      setRowCount(size);
  }
  @Override
  public void setRowIndex(int rowIndex) {
      /*
       * The following is in ancestor (LazyDataModel):
       * this.rowIndex = rowIndex == -1 ? rowIndex : (rowIndex % pageSize);
       */
      if (rowIndex == -1 || getPageSize() == 0) {
          super.setRowIndex(-1);
      }
      else
          super.setRowIndex(rowIndex % getPageSize());
  }}
  </code></pre>
  
  <p>Front END</p>
  
  <pre><code>&lt;p:dataTable id="listProduto" var="model" value="#{adminProdutoBean.lazyDataModel}" 
               paginator="true" rows="10"  
               paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
               rowsPerPageTemplate="5,10,15" lazy="true"&gt; 
  </code></pre>