Hibernate4懒加载失效 多次查询数据库

D-D 22:49:34,351 org.hibernate.SQL DEBUG select registrati0_.MemberId as MemberId3_1_, registrati0_.Id as Id1_, registrati0_.Id as Id4_0_, registrati0_.CreateTime as CreateTime4_0_, registrati0_.MemberId as MemberId4_0_, registrati0_.Name as Name4_0_, registrati0_.TrainingSchoolId as Training5_4_0_ from NDEP.dbo.Registrations registrati0_ where registrati0_.MemberId=?
D-D 22:49:34,351 org.hibernate.loader.Loader DEBUG Result set contains (possibly empty) collection: [com.mvc.frame.model.Members.registrationses#21]
D-D 22:49:34,351 internal.CollectionLoadContext DEBUG 1 collections were found in result set for role: com.mvc.frame.model.Members.registrationses
D-D 22:49:34,351 internal.CollectionLoadContext DEBUG Collection fully initialized: [com.mvc.frame.model.Members.registrationses#21]
D-D 22:49:34,351 internal.CollectionLoadContext DEBUG 1 collections initialized for role: com.mvc.frame.model.Members.registrationses
D-D 22:49:34,351 nal.StatefulPersistenceContext DEBUG Initializing non-lazy collections
D-D 22:49:34,351 org.hibernate.loader.Loader DEBUG Done loading collection
D-D 22:49:34,351 org.hibernate.loader.Loader DEBUG Loading collection: [com.mvc.frame.model.Members.memberBlacklistIpses#21]
D-D 22:49:34,351 org.hibernate.SQL DEBUG select memberblac0_.MemberId as MemberId3_1_, memberblac0_.id as id1_, memberblac0_.id as id2_0_, memberblac0_.CreateTime as CreateTime2_0_, memberblac0_.IpAddress as IpAddress2_0_, memberblac0_.MemberId as MemberId2_0_ from NDEP.dbo.MemberBlacklistIps memberblac0_ where memberblac0_.MemberId=?
D-D 22:49:34,351 org.hibernate.loader.Loader DEBUG Result set contains (possibly empty) collection: [com.mvc.frame.model.Members.memberBlacklistIpses#21]
D-D 22:49:34,351 internal.CollectionLoadContext DEBUG 1 collections were found in result set for role: com.mvc.frame.model.Members.memberBlacklistIpses
D-D 22:49:34,351 internal.CollectionLoadContext DEBUG Collection fully initialized: [com.mvc.frame.model.Members.memberBlacklistIpses#21]
D-D 22:49:34,351 internal.CollectionLoadContext DEBUG 1 collections initialized for role: com.mvc.frame.model.Members.memberBlacklistIpses
D-D 22:49:34,351 nal.StatefulPersistenceContext DEBUG Initializing non-lazy collections
D-D 22:49:34,351 org.hibernate.loader.Loader DEBUG Done loading collection
D-D 22:49:34,351 estResponseBodyMethodProcessor DEBUG Written [com.mvc.common.bean.SearchResult@4f2ce7fa] as "application/json;charset=UTF-8" using [org.springframework.http.converter.json.MappingJacksonHttpMessageConverter@d31f6b2]
D-D 22:49:34,351 .web.servlet.DispatcherServlet DEBUG Null ModelAndView returned to DispatcherServlet with name 'springmvc': assuming HandlerAdapter completed request handling
D-D 22:49:34,351 .web.servlet.DispatcherServlet DEBUG Successfully completed request
D-D 22:49:34,351 upport.OpenSessionInViewFilter DEBUG Closing Hibernate Session in OpenSessionInViewFilter
D-D 22:49:34,351 internal.LogicalConnectionImpl DEBUG Releasing JDBC connection
D-D 22:49:34,356 internal.LogicalConnectionImpl DEBUG Released JDBC connection
D-D 22:49:34,356 l.proxy.ConnectionProxyHandler DEBUG HHH000163: Logical connection releasing its physical connection
D-D 22:49:34,408 upport.OpenSessionInViewFilter DEBUG Using SessionFactory 'sessionFactory' for OpenSessionInViewFilter
D-D 22:49:34,409 ort.DefaultListableBeanFactory DEBUG Returning cached instance of singleton bean 'sessionFactory'
D-D 22:49:34,409 upport.OpenSessionInViewFilter DEBUG Opening Hibernate Session in OpenSessionInViewFilter
D-D 22:49:34,409 hibernate.internal.SessionImpl DEBUG Opened session at timestamp: 14196053744
D-D 22:49:34,409 upport.OpenSessionInViewFilter DEBUG Closing Hibernate Session in OpenSessionInViewFilter
D-D 22:49:34,416 upport.OpenSessionInViewFilter DEBUG Using SessionFactory 'sessionFactory' for OpenSessionInViewFilter
D-D 22:49:34,416 ort.DefaultListableBeanFactory DEBUG Returning cached instance of singleton bean 'sessionFactory'
D-D 22:49:34,416 upport.OpenSessionInViewFilter DEBUG Opening Hibernate Session in OpenSessionInViewFilter
D-D 22:49:34,416 hibernate.internal.SessionImpl DEBUG Opened session at timestamp: 14196053744
D-D 22:49:34,416 upport.OpenSessionInViewFilter DEBUG Closing Hibernate Session in OpenSessionInViewFilter

*******************hibernate实体****************************

@LazyCollection(LazyCollectionOption.TRUE)
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "members")
public Set<Registrations> getRegistrationses() {
    return this.registrationses;
}

public void setRegistrationses(Set<Registrations> registrationses) {
    this.registrationses = registrationses;
}

@LazyCollection(LazyCollectionOption.TRUE)
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "members")
public Set<MemberBlacklistIps> getMemberBlacklistIpses() {
    return this.memberBlacklistIpses;
}

public void setMemberBlacklistIpses(Set<MemberBlacklistIps> memberBlacklistIpses) {
    this.memberBlacklistIpses = memberBlacklistIpses;
}
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问