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