jirutka/rsql-parser

How to query for two values of a nested field?

gpr-indevelopment opened this issue · 4 comments

Suppose we have a Book class, that has an Authors field. The Author class has a name field.

public class Book {
    
    private List<Author> authors;
}

public class Author {

    private String name;
}

I want to be able to search for all books that has the authors "Rowling" AND "Tolkien" on the same persisted Book object. How can I achieve that?

I have tried things, with no success, like:

  • "authors.name==Rowling;authors.name==Tolkien" - Finds nothing.
  • "authors.name=in=(Rowling,Tolkien)" - Finds two Book objects even though there is only one persisted with both authors.

I have the same problem bro 😢

This has been answered here.
#29

After tumbling on this problem, i saw what you had missed was using distinct. Internally, the solution in #29 used Join, which resulted in duplicated rows in SQL.

Anyone found a way to solve it?