org.hibernate.LazyInitializationException: could not initialize proxy [xxxx] - no Session异常

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_33643072/article/details/81391998

这是由于hiberante的懒加载机制出现的问题

以下在SpringBoot项目中的两种解决方案

第一种是在实体类上加上注解

@Proxy(lazy = false)

第二种是在配置文件application.properties中加入

spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true

猜你喜欢

转载自blog.csdn.net/qq_33643072/article/details/81391998