graphql-java-kickstart / graphql-spring-boot

GraphQL and GraphiQL Spring Framework Boot Starters - Forked from oembedler/graphql-spring-boot due to inactivity.
https://www.graphql-java-kickstart.com/spring-boot/
MIT License
1.5k stars 325 forks source link

graphql-java-servlet 11.1.1 with Jpa FetchType.LAZY throw:no Session! but graphql-java-servlet 11.1.0 is OK #778

Closed heerzhang closed 2 years ago

heerzhang commented 3 years ago

I use 'graphql-spring-boot-starter' 11.1.0 version; it include graphql-java-servlet 11.1.1 version; And Jpa use @ManyToOne(fetch= FetchType.LAZY) ; However, graphql-java-servlet switching to version 11.1.0 is OK!! on graphql-java-servlet 11.1.1 Run error is:

n.g.e.SimpleDataFetcherExceptionHandler : Exception while fetching data (/getReportOfISP[0]/isp/task/liabler) : could not initialize proxy [md.specialEqp.inspect.Task#122] - no Session org.hibernate.LazyInitializationException: could not initialize proxy [md.specialEqp.inspect.Task#122] - no Session at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:170) ~[hibernate-core-5.4.32.Final.jar:5.4.32.Final] at graphql.kickstart.servlet.HttpRequestInvokerImpl.invoke(HttpRequestInvokerImpl.java:159) ~[graphql-java-servlet-11.1.1.jar:na] at graphql.kickstart.servlet.HttpRequestInvokerImpl.lambda$invokeAndHandleAsync$2(HttpRequestInvokerImpl.java:77) ~[graphql-java-servlet-11.1.1.jar:na]

application.yml file setting: spring. jpa. open-in-view: true

mention in passing; Jpa use @ManyToOne(fetch= FetchType.EAGER) with graphql-java-servlet 11.1.1 version also Run OK;

oliemansm commented 3 years ago

@heerzhang This is cause by a bugfix where the async timeout was not enforced graphql-java-kickstart/graphql-java-servlet#342. Unfortunately that resulted in some unexpected behavior. Will revert the default setting in v12.0.0 so by default async will not be enabled, which is more in line with how this library has worked in the past and with expectation of its users.