rsql-parser
rsql-parser copied to clipboard
How to query for two values of a nested field?
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. https://github.com/jirutka/rsql-parser/issues/29
After tumbling on this problem, i saw what you had missed was using distinct. Internally, the solution in https://github.com/jirutka/rsql-parser/issues/29 used Join, which resulted in duplicated rows in SQL.
Anyone found a way to solve it?