Description
Hello. My project was using spring boot 3.1.12, and I upgraded version to 3.2.0, but I started getting org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: could not initialize proxy - no Session
when trying to access child entities of my parent entity.
spring-boot-starter-jpa:3.2.0 uses Hibernate 6.3, in migration guide there is a paragraph 'Batch Fetching and LockMode', maybe this new behavor is the cause of my problem. How can I fix it, if I use Spring Data JPA? My method is annotated with @Transactional
and it worked fine before
@EntityGraph
is not an option because it increases endpoint response time too much, the same goes for fetch join
query (Hibernate will make 2 fetch joins in query for each parent entity, of which there may be many)