Uploaded image for project: 'Spring Data REST'
  1. Spring Data REST
  2. DATAREST-762

Pagination links incorrect when using QueryDSL integration

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.2 (Gosling SR2)
    • Fix Version/s: 3.3 RC1 (Neumann)
    • Component/s: Repositories
    • Labels:
      None

      Description

      As described in the linked StackOverflow question, it appears the pagination links are not correct or complete when using the QueryDSL integration. One would expect applied filters to also be applied to the pagination links but this isn't the case.

      I first suspected I might be using the wrong Repository interface as I was using the PagingAndSortingRepository and I had the suspicion that the paging and sorting in this repository might interfere with the paging in QueryDslPredicateExecutor. This isn't the case though as I get the exact same behavior when using CrudRepository and JpaRepository.

      I attached an example project which demonstrates this.

      Reproduction scenario

      • Extract the attached ZIP file.
      • Run the application: ./mvnw spring-boot:run
      • GET the collection resource: curl http://localhost:8080/examples
      • Verify that the response body contains correct pagination links in the {{_links} field.
      • Filter the collection resource with QueryDSL: curl http://localhost:8080/examples?exampleText=Another%20example
      • Verify that the response body contains incorrect pagination links in the {{_links} field as the applied filter is not present in the links. Clients can not use these links to page through their results.

      Additional information

      It appears that the generated links are based on the result set of the applied filter. For example when applying a stricter filter (e.g. curl http://localhost:8080/examples?exampleText=First%20example only the self and profile links are displayed because the applied filter only returns one result.

        Attachments

          Activity

            People

            Assignee:
            olivergierke Oliver Drotbohm
            Reporter:
            dennislaumen Dennis Laumen
            Last updater:
            lenzls
            Votes:
            8 Vote for this issue
            Watchers:
            9 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: