Aug 1st, 2007, 06:46 AM
I am using Spring 2.0.6 and Hibernate 3.2.2 to access my database. I have a search form which gets information out of the database, the search result returns is a huge amount of data. To avoid that this has to be handelt in memory I do pagination on the database side. I output the 10 first entries and when the user clicks next it should hit the database again an retrive the next 10 entries. Is there way in Spring to make pagination easier? Any hint, code or Documentation would be helpfull.
Aug 1st, 2007, 11:25 AM
Spring has support for it: PagedListHolder. You can also search the forums for it.
Aug 2nd, 2007, 09:47 AM
Thanks for the hint I had a look at it and also checked the Petstore sample. I think this is what I am looking for.
Aug 3rd, 2007, 04:25 PM
I am trying to solve exactly the same problem with the same version of spring/hibernate. I would greatly appreciate if you could pass me any info and/or code samples.
thanks in advance.
Aug 4th, 2007, 03:30 PM
Have you searched the forum? There have been some threads about paging lately.
Aug 5th, 2007, 09:22 AM
Yes I have and got some ideas. My understanding is that Spring provides client side solution through PagedListHolder and other flavor of this. It only works if you preload all the data but if you are expacting large result set which I am, I should look at serverside solution through hibernate and let the database take care of what it does best.
Code for hibernate is pretty simple. It is little more work from after that all the way to present it to UI. I hoping if someone has already written some code I could reuse it since I am new to both spring and hibernate. This way I would have better chance of avoiding mistakes and be able to present better solution to my manager.
Aug 5th, 2007, 09:05 PM
What's client-side and server-side in your understanding? PagedListHolder is Spring and so running on the server. By implementing the PagedList stuff properly it should be possible to not preload all data. Have a look at this post about the idea using RefreshablePagedListHolder and PagedListSourceProvider. But beware, since I haven't used this paging stuff yet and I don't know if the guy in the other thread has figured out its problem it still might contain errors.
Originally Posted by jmalkan
Aug 6th, 2007, 01:42 AM
I have solved the problem by wrting my own Paging class using Hibernate, but I am looking to find a solution using Spring. As soon I as got a proper solution I will post it here.
Aug 6th, 2007, 08:26 AM
By server-side I meant the database while client is the J2EE Server. I came accross some postings that suggested Hibernate is the better solution for paging through data. See this http://forum.springframework.org/sho...ination&page=2
Oct 5th, 2007, 03:55 AM
Spring JDBC Pagination Tutorial
Here's how I implemented database level pagination using Spring JDBC: