Skip to content

Question: Select only the columns requested by the graphql query #114

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

Closed
Thihup opened this issue Apr 22, 2019 · 3 comments
Closed

Question: Select only the columns requested by the graphql query #114

Thihup opened this issue Apr 22, 2019 · 3 comments
Labels

Comments

@Thihup
Copy link

Thihup commented Apr 22, 2019

Currently the JPA query select all columns of an entity.
It would be possible to just select the requested fields?

@igdianov
Copy link
Collaborator

igdianov commented Apr 22, 2019

@Thihup There is entity fetch graph provided in the query to persistence provider with only requested fields from the GraphQL query:

It works as a hint for persistent provider implementation, i.e. Hibernate to generate SQL query that retrieves only requested fields. The persistence provider decides how to generate SQL query and map it to the objects.

@molexx
Copy link
Contributor

molexx commented May 7, 2019

For reference, this is a known bug in Hibernate: https://hibernate.atlassian.net/browse/HHH-8776

@anotender
Copy link
Contributor

@igdianov Is it possible to resign from adding fetchgraph hint in favor of building the multiselect clause in QraphQLJpaBaseDataFetcher#getQuery by ourselves? Has it ever been considered? I've tried amending the code around there but I have troubles with properly mapping the result to the GraphQL result. I am not sure how much effort will it require.

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

No branches or pull requests

4 participants