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

queryDsl/springDateRest dynamic filter on manyToMany [DATAREST-773]

Open
#1,148 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

Florian GOURMELEN opened DATAREST-773 and commented

Hi,
I'm doing a test project of Spring data rest with querydsl (latest release versions of both as of now)
I have a set of 3 classes

  • Person
  • Record
  • Document

Record has a ManyToOne relation with person
Document has a manyToMany relation with record

These uri are working as expected

  • http://localhost:8080/records?label=Record1
  • http://localhost:8080/records?label=Record1&id=1
  • http://localhost:8080/records?person.firstName=Alex
  • http://localhost:8080/records?person.firstName=Alex&label=Record1

Now I would like to be able to perform a search on the manyToMany relation to find for example all the documents for which there is one record with label "Record1"
something like this to match the querydsl syntax

  • http://localhost:8080/documents?records.any.label=Record1

the aim would be to not only filter on the manytomany relation but also couple this filter with the filters on the other fields ex

  • http://localhost:8080/documents?records.any.label=Record1&label=Document1

because with a custom method added to the repository and a RepositoryRestController I'm able to perform the filter any but then I loose the advantage of querydsl if I want to filter also on other fields

  • http://localhost:8080/documents/search/recordLabelIn?label=Record1

Is it a bug? or is there any plan to embed this feature? or is it already there and I'm missing something?

I've attached a sample project I'm using for my tests

thanks in advance


Attachments:

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.