问题描述
- 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; }
时间: 2024-12-03 10:17:01