Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Paging

  1. #1
    Join Date
    Jun 2007
    Location
    Luxembourg, Europe
    Posts
    13

    Default Paging

    Hi all,

    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.

    Thanks,

  2. #2
    Join Date
    Nov 2005
    Location
    Reutlingen, Germany
    Posts
    2,098

    Default

    Spring has support for it: PagedListHolder. You can also search the forums for it.

    Joerg

  3. #3
    Join Date
    Jun 2007
    Location
    Luxembourg, Europe
    Posts
    13

    Wink

    Hi,

    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.

    Cheers;

  4. #4
    Join Date
    Jan 2006
    Posts
    22

    Default

    Hi,

    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.
    Jiggy

  5. #5
    Join Date
    Nov 2005
    Location
    Reutlingen, Germany
    Posts
    2,098

    Default

    Have you searched the forum? There have been some threads about paging lately.

    Joerg

  6. #6
    Join Date
    Jan 2006
    Posts
    22

    Default

    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.
    Jiggy

  7. #7
    Join Date
    Nov 2005
    Location
    Reutlingen, Germany
    Posts
    2,098

    Default

    Quote Originally Posted by jmalkan View Post
    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.
    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.

    Joerg
    This post can contain insufficient information.

  8. #8
    Join Date
    Jun 2007
    Location
    Luxembourg, Europe
    Posts
    13

    Default

    Hi

    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.

  9. #9
    Join Date
    Jan 2006
    Posts
    22

    Default

    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
    Jiggy

  10. #10
    Join Date
    Sep 2005
    Posts
    5

    Default Spring JDBC Pagination Tutorial

    Here's how I implemented database level pagination using Spring JDBC:

    http://www.codesuccess.com/tutorials/spring/pagination/

    Thanks,

    Andy Grove
    Code Success
    http://www.codesuccess.com/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •