title: Duplicate Data rows in LazyDataModel primefaces
body: <p>I have a problem with The lazyDataModel in Primefaces.
  If i have 1 result to show, one row is shown with the good one.
  If i have 2 result to show, two row are shown but the two row are the same.
  If i have 3 result to show, three row are shown but the three are the same.
  ...</p>
  
  <p>Have you an idea ?
  Why it doesn't work?</p>
  
  <p>Before i try to do something not generic, returning the categoryId in the getRowKey but it was the same error.</p>
  
  <p>(I dont know if it's tied(linked) but when i use the filter all the line disapear,no result possible)</p>
  
  <p>Here is my datatable :</p>
  
  <pre><code>    &lt;h:form&gt;
           &lt;p:dataTable id="table1" var="category" rowKey="#{category.categoryId}" value="#{listCategoryBean.lazyModel}" paginator="true" rows="7" paginatorPosition="bottom" 
               paginatorTemplate="{CurrentPageReport}  {FirstPageLink}{CurrentPageReport} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
               rowsPerPageTemplate="7,20,50,100" widgetVar="dataTable" currentPageReportTemplate="(Number of Records: {totalRecords})"
               emptyMessage="No screenshot data found with given criteria" lazy="true" scrollable="true" 
               scrollHeight="217" style="width: 100%;"&gt;  
  
  
      &lt;f:facet name="header"&gt;  
            #{msgs.categoryList}
      &lt;/f:facet&gt;  
  
      &lt;p:column headerText="#{msgs.common_name}" filterBy="#{msgs.common_name}" filterMatchMode="contains" style="width:25%"&gt; 
       &lt;h:outputText value="#{category.name}" /&gt;
      &lt;/p:column&gt;  
  
      &lt;p:column headerText="#{msgs.common_description}" style="width:25%"&gt;  
           &lt;h:outputText value="#{category.description}" /&gt;
      &lt;/p:column&gt;  
  
  &lt;/p:dataTable&gt;  
      &lt;/h:form&gt;
  </code></pre>
  
  <p>Here is my bean</p>
  
  <pre><code>   private LazyDataModelBase&lt;Category&gt; model =
              new LazyDataModelBase&lt;Category&gt;(categoryFacade);
  
      public void setModel(LazyDataModelBase&lt;Category&gt; model) {
          this.model = model;
      }
  
      public LazyDataModelBase&lt;Category&gt; getModel() {
          model.setFacade(categoryFacade);
          return model;
      }
  </code></pre>
  
  <p>Here is The LazyDataModelBase : </p>
  
  <p>public class LazyDataModelBase extends LazyDataModel {</p>
  
  <pre><code>private volatile AbstractFacade&lt;T&gt; facade;
  
  private List&lt;T&gt; data;  
  
  private int rowCount;
  
  @Override
  public int getRowCount() {
      return rowCount;
  }
  
  public void setRowCount(int rowCount) {
      this.rowCount = rowCount;
  }
  
  public LazyDataModelBase(AbstractFacade&lt;T&gt; facade) {
      super();
      this.facade = facade;
  }
  
  public final AbstractFacade&lt;T&gt; getFacade() {
      return facade;
  }
  
  public final void setFacade(AbstractFacade&lt;T&gt; facade) {
      this.facade = facade;
  }
  
  @Override
  public List&lt;T&gt; load(int first, int pageSize, String sortField,
          SortOrder sortOrder, Map&lt;String,String&gt; filters) {
      this.setRowCount(facade.count(filters));
      List&lt;T&gt; list = facade.load(first, pageSize,
          sortField, sortOrder, filters);
      data = list;
      if (list == null) {
          throw new RuntimeException("La liste est null");
      }
      return list;
  }
  
  
  @Override
  public T getRowData() {
        if(data == null)
            return null;
        int index =  super.getRowIndex() % super.getPageSize();
        if(index &gt; data.size()){
            return null;
        }
        return data.get(index);
  }
  
  
  
  @Override  
  public Object getRowKey(T object) {
      return object.toString();  
  } 
  
  
  
  @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>