Answers for "Hibernate: How does SetMaxresult work in pagination"

0

Hibernate: How does SetMaxresult work in pagination

Query q = session.createQuery("select * from Student");  // you can use order by also 
q.setFirstResult(3);    	                         // starting position of the record (first record is 0, that is, 0, 1, 2, 3)
q.setMaxResults(5);   	                                 // size of page; each page displays 5 records (3, 4, 5, 6, 7)
List list1 = q.list();  	                         // iterate the list to get each page with Iterator or for loop
Posted by: Guest on April-09-2021

Browse Popular Code Answers by Language