spring-projects / spring-projects/spring-data-rest

Lost paging after upgrading to 1.1.0.M1

Open
#90 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

I have forked one of the examples of spring data rest to demonstrate/reproduce the issue I'm reporting.
Steps to reproduce

  • clone repository at https://github.com/swapsapar/Spring-data-rest-sample
  • run "mvn clean jetty:run" to launch server
  • browse to http://localhost:8080/PersonWeb/people and notice the paged result
  • optionally add 20+ people records by POSTing to people via curl "curl http://localhost:8080/PersonWeb/people -X POST -H content-type:application/json -d '{"name":"bob"}'"
  • again notice the paged response http://localhost:8080/PersonWeb/people with additional links e.g. "people.next"
  • lets make code changes to reproduce the bug. just run "git cherry-pick 0dad5fc676b4de31cd476d7163f7a7520f41b684"
  • Now again launch server by "mvn clean jetty:run"
  • this time we have already added 30 records for People during server startup.
  • Notice the response at http://localhost:8080/PersonWeb/people
  • Instead of returning only 20 entries, all the 30+ entries are returned.
  • Missing links for paging "people.next"
  • Query as seen in console is missing "limit ?" format.
    So something is causing the pagination to not work after upgrade.
    I noticed in debugger that CrudRepository.findAll() is called instead of PagingAndSortingRepository.findAll(Pageable pageable)
    Cherry-pick change that caused the bug
    https://github.com/swapsapar/Spring-data-rest-sample/commit/0dad5fc676b4de31cd476d7163f7a7520f41b684

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the linked Spring-data-rest-sample reproduction with mvn clean jetty:run and the specified cherry-pick. Trace why CrudRepository.findAll() is selected instead of PagingAndSortingRepository.findAll(Pageable pageable). Done means responses are limited to the page size and include links such as people.next after the upgrade.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.