title: Hibernate pagination mechanism
body: <p>I am trying to use Hibernate pagination for my query (PostgreSQL )</p>
  
  <p>I set <code>setFirstResult(0)</code>, <code>setMaxResults(20)</code> for my SQL query. My code is like below:</p>
  
  <pre><code>Session session = getSessionFactory().getCurrentSession();
  session.beginTransaction();
  Query query = session.createQuery("FROM Customers");
  query.setFirstResult(0);
  query.setMaxResults(20);
  List&lt;T&gt; entities = query.list();
  session.getTransaction().commit();
  </code></pre>
  
  <p>but when viewing the SQL Hibernate log, I still see the full SQL query:</p>
  
  <pre><code>Hibernate: select customer0_.id as id9_, customer0_.customer_name as dst2_9_, customer0_.addres as dst3_9_ from tbl_customers customer0_  
  </code></pre>
  
  <p>Why there is no LIMIT OFFSET in query of Hibernate pagination SQL log?</p>
  
  <p>Does anyone know about Hibernate pagination mechanism?</p>
  
  <p>I guess that Hibernate will select all data, put data into Resultset, and then paging in Resultset, right?</p>