These are chat archives for graphql-java/graphql-java

Jan 2018
Marcel Overdijk
Jan 23 11:45
Btw @bbakerman found the issue with the Hibernate lazy loading issue
Spring Boot automatically registers a OpenEntityManagerInViewInterceptor and not a OpenEntityManagerInViewFilter.
The first one only handles typical Spring MVC requests and not e.g. the GraphQLServlet. The latter one will do.
Adding the OpenEntityManagerInViewFilter solved the problem.
Hope this info might help somebody else in the future.
That being said I wonder how others are using GraphQL-java.
I'm currently just experimenting with it and returned je JPA entities to keep my test project simple.
Normally - with a traditional web service - in my Controller layer I only return *Resource classes like PersonResource.
Marcel Overdijk
Jan 23 11:50
This PersonResource is assembled from a Person JPA entity and contains all info needed to expose in the REST endpoint.
Is this a pattern others are using in GraphQL-java as well?
Jonathan Weaver
Jan 23 22:39
If you are returning a single object you are kind of missing the point of GraphQL and the problems it solves for the added complexity.
It excels in entity-graph type situations where you normally are hitting many REST endpoints to stitch data together, reduces client complexity in combining these queries and only returning the fields the client explicitly requests.
Brad Baker
Jan 23 22:58
yup as said above by @jweaver-personal - graphql is all about combining a set of resources into an efficient query AND allowing the client to be in charge of what data attributes they get back.
the things to remember about graphql is its not REST - it is over HTTP and often uses JSON ….. but its not RESTian.
there are element of course that apply to both, for example evolving your on the wire schema and so on (additive only say)… but thye are often well apart