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

Extend a Repository with QueryDslPredicateExecutor enable the pager on Collection resources [DATAREST-914]

Open
#1,280 0 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

type: bug
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Benjamin Legendre opened DATAREST-914 and commented

Extending a not pager aware Repository (like CrudRepository or Repository) with QueryDslPredicateExecutor enable the Pager on Collection resources when calling

GET /{repository}

The expected behaviour is

  • extending a CrudRepository with QueryDslPredicateExecutor augment the Collection url with filter capabilities but not activate the Pager.

Concrete example:
The following repository enable collection resource with Sort capabilities only:

public interface UserAccountRepository 
    extends Repository<UserAccount, Integer> {

    List<UserAccount> findAll(Sort s);
}

Now, adding QueryDslPredicateExecutor:

public interface UserAccountRepository 
    extends Repository<UserAccount, Integer>,
            QueryDslPredicateExecutor<UserAccount> {

    List<UserAccount> findAll(Predicate p, Sort s);
}

Does activate the Pager and ignore the findAll Signature of the top Repository interface.
It seems logical because of the QueryDslPredicateExecutor findAll() methods Signatures.

The problem is it seems there is no way to tell Spring Data Rest not to use the page<T> findAll() method but the only one we declared on the top Repository.


Affects: 2.5.3 (Hopper SR3)

Reference URL: http://stackoverflow.com/questions/39741927/create-a-collection-resource-with-sort-and-querydsl-predicate-but-no-pageable

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.