Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to query for two values of a nested field? #45

Open
gpr-indevelopment opened this issue Dec 7, 2020 · 4 comments
Open

How to query for two values of a nested field? #45

gpr-indevelopment opened this issue Dec 7, 2020 · 4 comments

Comments

@gpr-indevelopment
Copy link

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
Copy link

I have the same problem bro 😢

@qnhant5010
Copy link

This has been answered here.
#29

@qnhant5010
Copy link

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
Copy link

Anyone found a way to solve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants