spring-projects / spring-projects/spring-data-commons

Latest Refactor on QueryDsl argument resolution breaks it when pagination and other parameters are supplied to the request [DATACMNS-1559]

Open
#1,988 1 comment 0 reactions 1 assignee View on GitHub

@mp911de is already working on this.

Since Dec 30, 2020.

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

Description

Marc opened DATACMNS-1559 and commented

QuerydslPredicateBuilder.getPredicate() was refactored 2 or 3 commits ago, changing the logic in a way that now when incoming params multimap is empty, a new empty BooleanBuilder() instance is returned. 

But when params multimap comes populated and it is iterated without any successful binding , instead of returning the coherent empty BooleanBuilder() instance, its getValue(), which equals null, is returned instead.

This means that behavior is inconsistent for when no relevant associations are found, the result is different depending on whether the multimap  is empty or contanis footobeignored.

 

This effectively affects current version of spring-data-rest's QuerydslAwareRootResourceInformationHandlerMethodArgumentResolver, since it was also refactored to instantiate QuerydslRepositoryInvokerAdapter only on the event of non null preficates, otherwise it returns the default invoker which is the UnwrappingRepository one that ignores querydsl predicates.

 

This means that  current released library resolves a QueryDsl aware invoker only if you don't provide pagination or other kinds of params 


Affects: 2.1.9 (Lovelace SR9)

Reference URL: https://github.com/spring-projects/spring-data-commons/blob/master/src/main/java/org/springframework/data/querydsl/binding/QuerydslPredicateBuilder.java

1 votes, 3 watchers

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.