延迟加载错误 [英] Lazy Loading error
问题描述
我在Spring MVC框架中使用Hibernate,并试图获取我的班级wth子类:
public class Scene实现Serializable {
private Long id;
私人作者作者;
//省略getters和setters
}
public class Author {
private Long id;
私人字符串名称;
//省略getters和setters
}
我的Hibernate配置如下:
< bean id =dataSourceclass =org.apache.commons.dbcp.BasicDataSourcedestroy-method = 接近 >
< property name =driverClassNamevalue =org.postgresql.Driver/>
< property name =urlvalue =jdbc:postgresql://127.0.0.1/doolloop2/>
< property name =usernamevalue =doolloop2/>
< property name =passwordvalue =doolloop/>
< / bean>
< bean id =sessionFactoryclass =org.springframework.orm.hibernate3.LocalSessionFactoryBean>
< property name =dataSourceref =dataSource/>
< property name =mappingLocations>
< list>
<值> WEB-INF / mapping / Scene.hbm.xml< /值>
<值> WEB-INF / mapping / Author.hbm.xml< /值>
< / list>
< / property>
< property name =hibernateProperties>
<道具>
< prop key =hibernate.dialect> org.hibernate.dialect.PostgreSQLDialect< / prop>
< prop key =hibernate.show_sql> true< / prop>
< prop key =hibernate.hbm2ddl.auto> update< / prop>
< prop key =hibernate.cache.use_second_level_cache> true< / prop>
< prop key =hibernate.cache.use_query_cache> true< / prop>
< prop key =hibernate.cache.provider_class> org.hibernate.cache.EhCacheProvider< / prop>
< /道具>
< / property>
< / bean>
< bean id =transactionManagerclass =org.springframework.orm.hibernate3.HibernateTransactionManager>
< property name =sessionFactoryref =sessionFactory/>
< / bean>
< bean id =txServiceclass =com.doolloop.services.TxDataBaseServiceImpl>
< property name =sessionFactory>
< ref local =sessionFactory/>
< / property>
< / bean>
现在我有了获取我的场景的方法:
@Override
@Transactional(readOnly = true)
public Scene getScene(Long id){
Session session = this.sessionFactory.getCurrentSession );
Query q = session.createQuery(从com.doolloop.objects.Scene场景中选择场景,其中scene.id =:id);
q.setLong(id,id);
场景场景=(场景)q.uniqueResult()
返回场景;
}
和我的弹簧mvc代码:
@RequestMapping(value =/ getSceneMetaData.dlp,method = RequestMethod.GET)
@ResponseBody
public Scene getSceneMetaData @RequestParam String id){
Scene scene = service.getScene(Long.parseLong(id));
返回场景;
}
当我执行它时,我得到了下面的异常:
2010年12月5日12:29:21 org.hibernate.LazyInitializationException< init>
SEVERE:未能延迟初始化角色集合:com.doolloop.objects.Scene.author,没有会话或会话已关闭
org.hibernate.LazyInitializationException:无法延迟初始化角色集合: com.doolloop.objects.Scene.vauthor,没有会话或会话已关闭
我使用它并理解发生这种情况是因为它在事务处理关闭时尝试读取作者,而默认情况下作者类是懒惰的,但我不明白的是如何修改我的代码以便解决它。
任何建议都更受欢迎。
UPD:这里是两个类的映射文件:
< class
name =com.doolloop.objects.Scene
table =scene
>
name =id
column =Id
type =java.lang.Long
unsaved-value =null
>
< generator class =sequence>
< param name =sequence> doolloop2.sceneseq< / param>
< / generator>
< / id>
<多对一
名称=作者
class =com.doolloop.objects.Author
cascade =all
column = authorid
unique =false
/>
< / class>
< hibernate-mapping>
< class
name =com.doolloop.objects.Author
table =authors
>
name =id
column =Id
type =java.lang.Long
unsaved-value =null
>
< generator class =sequence>
< param name =sequence> doolloop2.authorseq< / param>
< / generator>
< / id>
name =name
update =true
insert =true
not-null =false
独特=false
type =java.lang.String
>
< column name =name/>
< / property>
name =email
update =true
insert =true
not-null =false
独特=false
type =java.lang.String
>
< column name =email/>
< / property>
name =site
update =true
insert =true
not-null =false
独特=false
type =java.lang.String
>
< column name =site/>
< / property>
name =contactInfo
update =true
insert =true
not-null =false
独特=false
type =java.lang.String
>
< column name =contactInfo/>
< / property>
< / class>
UPD2 我将以下内容添加到我的web.xml中:
< listener>
< listener-class> org.springframework.web.context.ContextLoaderListener< / listener-class>
< / listener>
< context-param>
< param-name> contextConfigLocation< / param-name>
< param-value> WEB-INF / applicationContext.xml< / param-value>
< / context-param>
< filter>
< filter-name> openSessionInViewFilter< / filter-name>
< filter-class> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter< / filter-class>
< / filter>
< filter-mapping>
< filter-name> openSessionInViewFilter< / filter-name>
< url-pattern> /getSceneMetaData.dlp< / url-pattern>
< / filter-mapping>
它给了我以下例外:
org.codehaus.jackson.map.JsonMappingException:无法初始化代理 - 无会话(通过引用链:com.doolloop.objects.Scene [author] - > com.doolloop .objects.Author _ $$ _ javassist_4 [name])
Update3:
这是此操作的log4j输出:
2010 -12-06 11:48:09,031 DEBUG [org.springframework.orm.hibernate3.support.OpenSessionInViewFilter] - 为OpenSessionInViewFilter使用SessionFactory'sessionFactory'
2010-12-06 11:48:09,036 DEBUG [org.springframework .beans.factory.support.DefaultListableBeanFactory] - 返回单例bean的缓存实例'sessionFactory'
2010-12-06 11:48:09,040 DEBUG [org.springframework.orm.hibernate3.support.OpenSessionInViewFilter] - 打开单个OpenSessionInViewFilter中的Hibernate会话
2010-12-06 11:48:09,042 DEBUG [o rg.springframework.orm.hibernate3.SessionFactoryUtils] - 打开Hibernate Session
DEBUG [org.springframework.web.servlet.DispatcherServlet] - 名为'doolloop'的DispatcherServlet处理GET请求为[/dlp/getSceneMetaData.dlp]
2010-12-06 11:48:09 DEBUG [org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping] - 将[/getSceneMetaData.dlp]映射到HandlerExecutionChain handler [com.doolloop.controllers.SceneController@21c33b55]和2个拦截器
2010-12-06 11:48:09,060 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Last-Modified value for [/ dlp /getSceneMetaData.dlp]是:-1
2010-12-06 11:48:09,142 DEBUG [org.springframework.core.convert.support.GenericConversionService] - 转换[TypeDescriptor java.lang。 String]到[TypeDescriptor @ org.springframework.web.bind.annotation.RequestParam java.lang.String]
2010-12-06 11:48:09,146 DEBUG [org.springframework.core.co nvert.support.GenericConversionService] - 转换为'140'
2010-12-06 11:48:09,148 DEBUG [org.springframework.web.bind.annotation.support.HandlerMethodInvoker] - 调用请求处理方法:public com .doolloop.objects.Scene com.doolloop.controllers.SceneController.getSceneMetaData(java.lang.String)
2010-12-06 11:48:16,401 DEBUG [org.springframework.web.servlet.mvc.annotation。 AnnotationMethodHandlerExceptionResolver] - 解决处理异常[com.doolloop.controllers.SceneController@21c33b55]:org.codehaus.jackson.map.JsonMappingException:无法初始化代理 - 无会话(通过引用链:com.doolloop.objects.Scene [作者] - > com.doolloop.objects.Author _ $$ _ javassist_4 [name])
2010-12-06 11:48:16,561 DEBUG [org.springframework.web.servlet.mvc.annotation。 ResponseStatusExceptionResolver] - 解决处理异常[com.doolloop.controllers.SceneController@21c33b55]:org.codehaus.jackson.map.JsonMappingException:无法初始化ialize代理 - 无会话(通过引用链:com.doolloop.objects.Scene [author] - > com.doolloop.objects.Author _ $$ _ javassist_4 [name])
2010-12-06 11:48:16,568 DEBUG [org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver] - 解决处理异常[com.doolloop.controllers.SceneController@21c33b55]:org.codehaus.jackson.map.JsonMappingException:could not初始化代理 - 无会话(通过引用链:com.doolloop.objects.Scene [author] - > com.doolloop.objects.Author _ $$ _ javassist_4 [name])
2010-12-06 11:48:16,572 DEBUG [org.springframework.web.servlet.DispatcherServlet] - 无法完成请求
org.codehaus.jackson.map.JsonMappingException:无法初始化代理 - 无会话(通过引用链:com。 doolloop.objects.Scene [author] - > com.doolloop.objects.Author _ $$ _ javassist_4 [name])
at org.codehaus.jackson.map.JsonMappingException.wrapWithPath(JsonMappingException.java: 215)
//// Ent愤怒堆栈跟踪在这里。
2010-12-06 11:48:16,660 DEBUG [org.springframework.orm.hibernate3.support.OpenSessionInViewFilter] - 在OpenSessionInViewFilter中关闭单个Hibernate Session
2010-12-06 11: 48:16,662 DEBUG [org.springframework.orm.hibernate3.SessionFactoryUtils] - 关闭Hibernate Session
Update4:
我只看到一个select n控制台:
Hibernate:选择scene0_.Id作为id20_0_,scene0_.name作为name20_0_,scene0_.description作为descript3_20_0_,scene0_.defaultView作为defaultV4_20_0_,scene0_.authorid作为authorid20_0_从scene0场景scene0_ where scene0_.Id =?
但是,如果我修改我的getScene方法:
public Scene getScene(Long id){
Session session = this.sessionFactory.getCurrentSession();
Query q = session.createQuery(从com.doolloop.objects.Scene场景中选择场景,其中scene.id =:id);
q.setLong(id,id);
场景场景=(场景)q.uniqueResult()
**作者author = scene.getAuthor(); **
返回场景;
我会看到第二个选择出现:
<$休眠:选择author0_.Id作为Id23_0_,author0_.name作为name23_0_,author0_.email作为email23_0_,author0_.site作为site23_0_,author0_.contactInfo作为contactI5_23_0_作者author0_,其中author0_.Id = ?
但作者对象仍然是空的。
从控制器调用同一个getter会导致异常。
可能值得发布Scene.hbm.xml和Author.hbm。 xml第一..
从我在这里看到的:
https://forum.hibernate.org/viewtopic.php?f=1&t=994772&start=0
如果您使用注释,默认情况下会加载EAGERLY EAGERLY,但如果您使用XML映射,则不会发生这种情况!!
我会说修改多对一关系并明确设置 fetch =EAGER
。
<多对一
name =author
class =com.doolloop。 objects.Author
cascade =all
column =authorid
unique =false
fetch = EAGER
/>
你已经提到过你有两种使用场景:一种是获取Scene对象并且你需要它的所有依赖关系,以及只对id和其中一些领域感兴趣的地方。这似乎是定义Hibernate会话边界的问题。你可以使用这里描述的SessionInViewFilter: http://community.jboss.org/wiki/OpenSessioninView 这样,Hibernate会话将在http请求期间打开,因此您将能够访问延迟加载的引用,以便呈现时间。这有帮助吗?
=============================== ==
我见过你的OpenSessionInViewFilter定义 - 它可能值得明确地设置你的HibernateSessionFactory的名字:
<滤光器>
< filter-name> openSessionInViewFilter< / filter-name>
< filter-class> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter< / filter-class>
< init-param>
< param-name> sessionFactoryBeanName< / param-name>
< param-value> sessionFactory< / param-value>
< / init-param>
< / filter>
另外,我在Spring配置中看不到Tx管理器的正确初始化。只需定义它是不够的,您需要:
< tx:注释驱动的事务管理器=transactionManager/> ;
===================== =============
从我在Hibernate文档中看到的情况来看,很可能一旦关闭事务,Hibernate会话就会结束(即使你使用OpenSessionInView Filter)。
看看这里:
http://community.jboss.org/一旦你关闭你的事务,数据库连接将返回到池中,并且所有对数据库的进一步访问将需要一个数据库新的连接,它应该有自动提交模式。
然而,就你而言,我认为解决方案是确保你已经加载了你所需要的在事务处于打开状态时从数据库加载!
I know that this issue was already raised here several time. However I couldn't find any solution which will help so I decided to post it again.
I'm using Hibernate with Spring MVC framework and I'm trying to fetch my class wth sub class:
public class Scene implements Serializable{
private Long id;
private Author author;
//omitting getters and setters
}
public class Author{
private Long id;
Private String name;
//omitting getters and setters
}
My Hibernate configuration is the following:
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="url" value="jdbc:postgresql://127.0.0.1/doolloop2" />
<property name="username" value="doolloop2" />
<property name="password" value="doolloop" />
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mappingLocations">
<list>
<value>WEB-INF/mapping/Scene.hbm.xml</value>
<value>WEB-INF/mapping/Author.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="txService" class="com.doolloop.services.TxDataBaseServiceImpl">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
Now I have methods which gets my scene:
@Override
@Transactional(readOnly = true)
public Scene getScene(Long id) {
Session session = this.sessionFactory.getCurrentSession();
Query q = session.createQuery("select scene from com.doolloop.objects.Scene scene where scene.id=:id");
q.setLong("id", id);
Scene scene = (Scene)q.uniqueResult()
return scene;
}
and my spring mvc code:
@RequestMapping(value="/getSceneMetaData.dlp",method = RequestMethod.GET)
@ResponseBody
public Scene getSceneMetaData(@RequestParam String id){
Scene scene = service.getScene(Long.parseLong(id));
return scene;
}
When I'm executing it i got the followng exception:
Dec 5, 2010 12:29:21 PM org.hibernate.LazyInitializationException <init>
SEVERE: failed to lazily initialize a collection of role: com.doolloop.objects.Scene.author, no session or session was closed
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.doolloop.objects.Scene.vauthor, no session or session was closed
I googled it and understand that it happens because it tries to fetch author when Transaction is closed and that author class is lazy by default, but what I can't understand is how should I modify my code n order to solve it.
Any suggestion s more the welcomed.
UPD: here is the mapping files for both classes:
<class
name="com.doolloop.objects.Scene"
table="scene"
>
<id
name="id"
column="Id"
type="java.lang.Long"
unsaved-value="null"
>
<generator class="sequence">
<param name="sequence">doolloop2.sceneseq</param>
</generator>
</id>
<many-to-one
name="author"
class="com.doolloop.objects.Author"
cascade="all"
column="authorid"
unique="false"
/>
</class>
<hibernate-mapping>
<class
name="com.doolloop.objects.Author"
table="authors"
>
<id
name="id"
column="Id"
type="java.lang.Long"
unsaved-value="null"
>
<generator class="sequence">
<param name="sequence">doolloop2.authorseq</param>
</generator>
</id>
<property
name="name"
update="true"
insert="true"
not-null="false"
unique="false"
type="java.lang.String"
>
<column name="name" />
</property>
<property
name="email"
update="true"
insert="true"
not-null="false"
unique="false"
type="java.lang.String"
>
<column name="email" />
</property>
<property
name="site"
update="true"
insert="true"
not-null="false"
unique="false"
type="java.lang.String"
>
<column name="site" />
</property>
<property
name="contactInfo"
update="true"
insert="true"
not-null="false"
unique="false"
type="java.lang.String"
>
<column name="contactInfo" />
</property>
</class>
UPD2 I added the following to my web.xml:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/applicationContext.xml</param-value>
</context-param>
<filter>
<filter-name>openSessionInViewFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>openSessionInViewFilter</filter-name>
<url-pattern>/getSceneMetaData.dlp</url-pattern>
</filter-mapping>
it gave me the following exception:
org.codehaus.jackson.map.JsonMappingException: could not initialize proxy - no Session (through reference chain: com.doolloop.objects.Scene["author"]->com.doolloop.objects.Author_$$_javassist_4["name"])
Update3:
This is the log4j output for this operation:
2010-12-06 11:48:09,031 DEBUG [org.springframework.orm.hibernate3.support.OpenSessionInViewFilter] - Using SessionFactory 'sessionFactory' for OpenSessionInViewFilter
2010-12-06 11:48:09,036 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'sessionFactory'
2010-12-06 11:48:09,040 DEBUG [org.springframework.orm.hibernate3.support.OpenSessionInViewFilter] - Opening single Hibernate Session in OpenSessionInViewFilter
2010-12-06 11:48:09,042 DEBUG [org.springframework.orm.hibernate3.SessionFactoryUtils] - Opening Hibernate Session
2010-12-06 11:48:09,048 DEBUG [org.springframework.web.servlet.DispatcherServlet] - DispatcherServlet with name 'doolloop' processing GET request for [/dlp/getSceneMetaData.dlp]
2010-12-06 11:48:09,056 DEBUG [org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping] - Mapping [/getSceneMetaData.dlp] to HandlerExecutionChain with handler [com.doolloop.controllers.SceneController@21c33b55] and 2 interceptors
2010-12-06 11:48:09,060 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Last-Modified value for [/dlp/getSceneMetaData.dlp] is: -1
2010-12-06 11:48:09,142 DEBUG [org.springframework.core.convert.support.GenericConversionService] - Converting value '140' of [TypeDescriptor java.lang.String] to [TypeDescriptor @org.springframework.web.bind.annotation.RequestParam java.lang.String]
2010-12-06 11:48:09,146 DEBUG [org.springframework.core.convert.support.GenericConversionService] - Converted to '140'
2010-12-06 11:48:09,148 DEBUG [org.springframework.web.bind.annotation.support.HandlerMethodInvoker] - Invoking request handler method: public com.doolloop.objects.Scene com.doolloop.controllers.SceneController.getSceneMetaData(java.lang.String)
2010-12-06 11:48:16,401 DEBUG [org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerExceptionResolver] - Resolving exception from handler [com.doolloop.controllers.SceneController@21c33b55]: org.codehaus.jackson.map.JsonMappingException: could not initialize proxy - no Session (through reference chain: com.doolloop.objects.Scene["author"]->com.doolloop.objects.Author_$$_javassist_4["name"])
2010-12-06 11:48:16,561 DEBUG [org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver] - Resolving exception from handler [com.doolloop.controllers.SceneController@21c33b55]: org.codehaus.jackson.map.JsonMappingException: could not initialize proxy - no Session (through reference chain: com.doolloop.objects.Scene["author"]->com.doolloop.objects.Author_$$_javassist_4["name"])
2010-12-06 11:48:16,568 DEBUG [org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver] - Resolving exception from handler [com.doolloop.controllers.SceneController@21c33b55]: org.codehaus.jackson.map.JsonMappingException: could not initialize proxy - no Session (through reference chain: com.doolloop.objects.Scene["author"]->com.doolloop.objects.Author_$$_javassist_4["name"])
2010-12-06 11:48:16,572 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Could not complete request
org.codehaus.jackson.map.JsonMappingException: could not initialize proxy - no Session (through reference chain: com.doolloop.objects.Scene["author"]->com.doolloop.objects.Author_$$_javassist_4["name"])
at org.codehaus.jackson.map.JsonMappingException.wrapWithPath(JsonMappingException.java:215)
//// Entire stack trace goes here.
2010-12-06 11:48:16,660 DEBUG [org.springframework.orm.hibernate3.support.OpenSessionInViewFilter] - Closing single Hibernate Session in OpenSessionInViewFilter
2010-12-06 11:48:16,662 DEBUG [org.springframework.orm.hibernate3.SessionFactoryUtils] - Closing Hibernate Session
Update4:
I see only one select n console:
Hibernate: select scene0_.Id as Id20_0_, scene0_.name as name20_0_, scene0_.description as descript3_20_0_, scene0_.defaultView as defaultV4_20_0_, scene0_.authorid as authorid20_0_ from scene scene0_ where scene0_.Id=?
However if I modify my getScene method that way:
public Scene getScene(Long id) {
Session session = this.sessionFactory.getCurrentSession();
Query q = session.createQuery("select scene from com.doolloop.objects.Scene scene where scene.id=:id");
q.setLong("id", id);
Scene scene = (Scene)q.uniqueResult()
**Author author = scene.getAuthor();**
return scene;
I will see second select appears:
Hibernate: select author0_.Id as Id23_0_, author0_.name as name23_0_, author0_.email as email23_0_, author0_.site as site23_0_, author0_.contactInfo as contactI5_23_0_ from authors author0_ where author0_.Id=?
but author object wll be still empty.
calling the same getter from controller causes exception.
It's probably worth posting Scene.hbm.xml and Author.hbm.xml first..
From what I've seen here: https://forum.hibernate.org/viewtopic.php?f=1&t=994772&start=0 Many-to-One relationships are loaded EAGERLY by default if you use annotations, however that's not what happens if you use XML mappings!!
I'd say modify the Many-to-One relationship and explicitly set fetch="EAGER"
.
So the result should be:
<many-to-one
name="author"
class="com.doolloop.objects.Author"
cascade="all"
column="authorid"
unique="false"
fetch="EAGER"
/>
You've mentioned that you have 2 usage scenarios: one where you fetch the Scene object and you need all its dependencies and one where you're only interested in the id and a few fields for it. This seems to be a matter of defining the Hibernate Session boundaries. You can use the SessionInViewFilter described here: http://community.jboss.org/wiki/OpenSessioninView This way, the Hibernate session will be open for the duration of a http request, so you will be able to access lazy loaded references right to render time. Does this help?
=================================
I've seen your OpenSessionInViewFilter definition - it maybe worth explicitly setting the name of your HibernateSessionFactory:
<filter>
<filter-name>openSessionInViewFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>sessionFactoryBeanName</param-name>
<param-value>sessionFactory</param-value>
</init-param>
</filter>
Also, I don't see a proper initialization of your Tx Manager in your Spring Config. Just defining it is not enough, you need:
<tx:annotation-driven transaction-manager="transactionManager"/>
=================================
From what I've seen in Hibernate documentation, it is very likely that once you close the transaction, your Hibernate session will end (even if you use OpenSessionInView Filter).
Have a look here:
http://community.jboss.org/wiki/OpenSessioninView#Can_I_commit_the_transaction_before_rendering_the_view
Once you're closing your transaction, the db connection is returned to the pool and all further access to the DB will require a new connection, which should have the auto-commit mode on.
However, in your case, I think the solution would be to make sure you've loaded all you need to load from the DB while the transaction is still open!
这篇关于延迟加载错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!