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

Bug: 'where' filter on nested many-to-one not working #77

Closed
molexx opened this issue Feb 5, 2019 · 3 comments · Fixed by #108
Closed

Bug: 'where' filter on nested many-to-one not working #77

molexx opened this issue Feb 5, 2019 · 3 comments · Fixed by #108
Assignees
Labels

Comments

@molexx
Copy link
Contributor

molexx commented Feb 5, 2019

It seems where clauses on a nested many-to-one relationship are ignored.

I've updated the example app to demonstrate the problem. There aren't enough '-to-one' relationships available in the example model to recreate so I've added a new one - a Droid's PrimaryFunction replacing String primaryFunction:

https://github.com/molexx/graphql-jpa-query/tree/filterNestedManyToOne/graphql-jpa-query-example/src/main/java/com/introproventures/graphql/jpa/query/example/model

This simpler example works - only the Astromech is returned:

query {
    Droids {
        select {
            name
            primaryFunction(where:{function:{EQ:"Astromech"}}) {
                function
            }
        }
    }
}

But this one doesn't - the Protocol droid is also returned:

query {
    Humans {
        select {
            id
            name
            homePlanet
            favoriteDroid {
                name
                primaryFunction(where:{function:{EQ:"Astromech"}}) {
                      function
                }
            }
        }
    }
}

I've also applied the model changes to graphql-jpa-query-schema's tests and added the above two examples as tests - the second one currently fails as the Protocol droid and its parent Luke Skywalker should not be returned.

https://github.com/molexx/graphql-jpa-query/blob/796b6488da4ece90b5ec705b097c0462740180fd/graphql-jpa-query-schema/src/test/java/com/introproventures/graphql/jpa/query/schema/StarwarsQueryExecutorTests.java#L615

@igdianov
Copy link
Collaborator

igdianov commented Feb 5, 2019

@molexx This is good one! Can you send the PR with the failing test case. I will look into it. Thank you!

@igdianov igdianov added the bug label Feb 5, 2019
@igdianov igdianov self-assigned this Feb 5, 2019
molexx added a commit to molexx/graphql-jpa-query that referenced this issue Mar 15, 2019
@igdianov
Copy link
Collaborator

igdianov commented Apr 7, 2019

@molexx Sorry for delay. I will take a look at this

@igdianov
Copy link
Collaborator

@molexx I think I am going to deprecate embedded many-to-one where criteria expressions in favor of #108. I do not like to deal with two implementations in the future.

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

Successfully merging a pull request may close this issue.

2 participants