I'm a novice Hibernate user, and am trying to create some "list" pages that include sorting, paging and checkboxes for deleting. Basically the same exact thing you would see in a webmail client like Hotmail, or Yahoo Mail.
I want to do this in an efficent, easy to code way. I already have Paging working using the Page class at the bottom of this page:
http://blog.hibernate.org/cgi-bin/pollx ... ation.html
I'm not sure what strategy I should take for
so many aspects of this. For example, should I retrieve the entire result set for my list and keep it in the user's session and do sorting/processing based on that session list? Or should I hit the database each time the user pages, sorts, or does an action? I understand the tradeoffs of each, but what is the more common technique with hibernate?
If I go the route of hitting the database each time, I'm confused as to how to do the sorting. I'm using createQuery right now, and I can't figure out how to change the order by column and order. Is it only possible to change these values when using createCriteria?
And how would I process user actions? My idea would be to have checkboxes for each row of data in the page with the PK as the value, and when the form is submitted, pass all of these values into an IN expression in the where clause of an UPDATE or DELETE. I don't see how I can do this with a Query object either. Alternatively, I guess I would have to loop through each PK, and call a hibernate delete on each one.
I'll stop here and just ask if I'm thinking about Hibernate's coding strategy in the right way. I want to get into the right mindset, but I'm having trouble getting there.
Are there any example applications out there that implement this "list" type of feature I'm trying to do?
Thanks :)