All entries for Tuesday 26 October 2004

October 26, 2004

Hibernate built in paging support

Didn't realise this until just now, but Hibernate has built in paging support.

Query query = sess.createQuery(queryStr);
return query.list();

This handy little snippet will automagically return 10 objects, starting at object 20. And of course, chances are that hibernate has actually got all the objects you want in memory anyway, so it'll probably never even touch the database. Lovely.

In case anyone wondered, this means that there'll soon be "Older entries" and "Newer entries" links at the bottom of pages listing lots of entries.

October 2004

Mo Tu We Th Fr Sa Su
Sep |  Today  | Nov
            1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31


Search this blog

Most recent comments

  • One thing that was glossed over is that if you use Spring, there is a filter you can put in your XML… by Mathew Mannion on this entry
  • You are my hero. by Mathew Mannion on this entry
  • And may all your chickens come home to roost – in a nice fluffy organic, non–supermarket farmed kind… by Julie Moreton on this entry
  • Good luck I hope that you enjoy the new job! by on this entry
  • Good luck Kieran. :) by on this entry


Not signed in
Sign in

Powered by BlogBuilder