quarkus-quickstarts
quarkus-quickstarts copied to clipboard
Provide Example showing graphql query parameters being passed to hibernate queries in microprofile-graphql-quickstart
Hi, Could the https://github.com/quarkusio/quarkus-quickstarts/tree/main/microprofile-graphql-quickstart be updated to show how to pass the graphql query parameters be passed to hibernate in a generic way so that the query is not fetching all the columns?
If you use JPA and lazy loading that should already be enough for the important cases. I'll do a blog post about that soon. For a single table, doing select * vs select certain fields does not make that big of a change, except if your table is huge. For that you basically Inject Context and look at the requested fields. I don't think that should be part of the quickstart, but can be documented somewhere.
Thank you @phillip-kruger, that would be really nice, and I do see a value for a single table as well when the returned rows are more than 10000 from DB.
When the returned rows is more than 10000 then you probably want to look at paging (the rows) rather than limiting the cols. That can be done at the moment by passing in a pageNumber and pageSize. We do have an item on our todo list to make this easier from a GraphQL point of view, so something like a @Pageable on the method that returns a list, but for now you will have to handle the parameters yourself. https://github.com/smallrye/smallrye-graphql/issues/455