title: Hibernate Criteria for Pagination
body: <p>I am trying to fetch 10 rows or records per page using the Hibernate code as below,</p>
  
  <pre><code>List&lt;?&gt; sportsList = session
                          .createCriteria(SportsDAO.class)
                          .setFirstResult((Integer.valueOf(pageNo) - 1)* 10)
                          .setMaxResults(10)
                          .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY)
                          .list();
  </code></pre>
  
  <p>But, the sportsList at times return only 3 values or lesser, even with more than 100 total records present in the Database.</p>
  
  <p>What would be the change required in the above code to fetch 10 records based on Page Number (pageNo variable = 1, 2 , 3, etc..)</p>