Do you know how I can get the previous and next row given the current row? Example, let's say I want to get 1row by a criteria. Now I have this row, I would like to get the previous and next row from this one. How would I do this?
Thanks!
tcollins wrote:
Check this out... it talks about using a comparator to order collections.
http://www.hibernate.org/hib_docs/reference/html/collections.html#collections-s1-8aThis is how we do paging / navigatable list.
NOTE: the query String could have and probably would have an "order by" clause at the end of it.Code:
Query q = session.createQuery(query);
q.setMaxResults(maxRecordsPerPage);
q.setFirstResult(((pageNum - 1) * maxRecordsPerPage));
List list = q.list();
hope this helped :)