1
说我有一个相关的实体孩子(可为空)的实体家长与@OneToMany(fetch = FetchType.LAZY)
关系Hibernate没有检查初始化懒惰实体吗?
在我的行动豆,将下面的代码初始化子实体?
boolean hasChild = false;
if(parent.getChild()!=null){
hasChild = true;
}
我看到它说Lazy collection fetching: a collection is fetched when the application invokes an operation upon that collection. This is the default for collections.
的文档,但不知道,如果一个空检查被归类为操作
感谢
与你的问题相关:看看类“org.hibernate.Hibernate”。有各种与懒惰对象相关的效用方法。感谢Jan, – 2013-04-04 10:58:35
会做 – DaveB 2013-04-04 11:06:20