How to query for two values of a nested field?
gpr-indevelopment opened this issue · 4 comments
gpr-indevelopment commented
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.
BrunoJCosta commented
I have the same problem bro 😢
qnhant5010 commented
This has been answered here.
#29
qnhant5010 commented
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.
konopkin11 commented
Anyone found a way to solve it?