📜  Hibernate:SetMaxresult 如何在分页中工作 - 无论代码示例

📅  最后修改于: 2022-03-11 15:00:34.359000             🧑  作者: Mango

代码示例1
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