0
我有User
到Cars
1对n。 映射:休眠:目标虚拟机发生异常:未能延迟初始化集合
用户:
<set inverse="true" name="cars" table="CAR">
<key>
<column name="UserID" not-null="false"/>
</key>
<one-to-many class="entity3.Car"/>
</set>
汽车:
<many-to-one class="entity3.User" name="user">
<column name="UserID" not-null="false"/>
</many-to-one>
后,我得到一些用户关闭会话,调试器,在user
我看到PersistentSet cars
与此异常的价值:
>Exception occurred in target VM: failed to lazily initialize a collection of role: entity3.User.cars, no session or session was closed
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: entity3.User.cars, no session or session was closed
这是正常行为吗?那些例外会减慢性能吗?