org.hibernate.LazyInitializationException: could not initialize proxy [xxxx] - no Session异常
程序员文章站
2022-04-18 22:54:15
...
这是由于hiberante的懒加载机制出现的问题
以下在SpringBoot项目中的两种解决方案
第一种是在实体类上加上注解
@Proxy(lazy = false)
第二种是在配置文件application.properties中加入
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
下一篇: php设计模式 适配器模式
推荐阅读
-
could not initialize proxy - no Session
-
解决:org.hibernate.LazyInitializationException: could not initialize proxy - no Session
-
HTTP Status 500 - Could not write content: could not initialize proxy - no Session
-
could not initialize proxy - no Session:解决懒加载(排除不需要查询显示的属性)
-
org.hibernate.LazyInitializationException: could not initialize proxy [xxxx] - no Session异常
-
Hiberante异常之org.hibernate.LazyInitializationException: could not initialize proxy - no Session
-
【记录】异常:org.hibernate.LazyInitializationException: could not initialize proxy - no Session
-
org.hibernate.LazyInitializationException: could not initialize proxy 解决方案(JPA)
-
Jpa项目报错:org.hibernate.lazyinitializationexception could not initialize proxy - no session
-
org.hibernate.LazyInitializationException: could not initialize proxy no Session