Results 1 to 3 of 3

Thread: Spring Data Pagination "Page" at the service layer?

Hybrid View

  1. #1
    Join Date
    Mar 2007
    Posts
    128

    Default Spring Data Pagination "Page" at the service layer?

    I'm not sure how to categorize this question - it's not a really a problem, but trying to separate implementations.

    I'm using Spring Data JPA. I have my repository set up to do pagination.

    When I set up my service layer it looks something like this:
    Code:
    public Page<ReturnRow> findWhatever(int iDisplayStart, int iDisplayLength, sortStuff, etc.) {...}
    It works perfectly. Spring data rocks.

    My issue is with me using Page<ReturnRow> as my return value. Page is Spring Data specific. What if I decide to switch to another DAO implementation (highly unlikely, but it's possible)? Is there a more suitable/standard 'non-implementation' specific way to return pageination information or is everyone just creating their own service layer implementation?

    Does that make any sense?

  2. #2
    Join Date
    Nov 2012
    Posts
    7

    Default

    you can return a List if you want.

  3. #3
    Join Date
    Mar 2007
    Posts
    128

    Default

    That's one idea, but Page also has some additional information such as how many total records exist vs. how many were returned for this page, how many total pages, etc. I ended up just using the Page.

Posting Permissions

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