How to get let's say 20-35 rows fromt eh table?
How can I select it in Hibernate?
something like that:
myTable.Skip(20).Take(15);
Thanks.
A combination between Query#setFirstResult(int i) and Query#setMaxResults(int i) will skip the first 20 records and will fetch the next 15 (as shown in the example) :
List<Table> page3 = session.createQuery(
"from Table")
.setFirstResult(20)
.setMaxResults(15).list();
List<YourTable> query = session.createQuery("from yourtable").setFirstResult(20).setMaxResults(15).list();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With