日期:2014-05-19  浏览次数:20645 次

hibernate和ACCESS连接出现的问题
直接对单个实体类进行查询可以,碰到含有一对多等关系时候,set集合无法查询出来
Hibernate: select informatio0_.INFOID as INFOID0_, informatio0_.NAME as NAME0_ from INFORMATION informatio0_
Hibernate: select attributes0_.INFOID as INFOID1_, attributes0_.ATT_ID as ATT1_1_, attributes0_.ATT_ID as ATT1_2_0_, attributes0_.INFOID as INFOID2_0_, attributes0_.ATT_NAME as ATT3_2_0_, attributes0_.ATT_CONTEXT as ATT4_2_0_, attributes0_.ISCHLID as ISCHLID2_0_, attributes0_.ATT_TUPIAN as ATT6_2_0_ from ATTRIBUTE attributes0_ where attributes0_.INFOID=?
下面是错误信息
org.hibernate.exception.GenericJDBCException: could not initialize a collection: [com.entity.Information.attributes#3]
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:132)
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:120)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
org.hibernate.loader.Loader.loadCollection(Loader.java:2043)
org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:62)
org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:628)
org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:83)
org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1853)
org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:476)
org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:890)
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:276)
org.hibernate.loader.Loader.doList(Loader.java:2249)
org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2146)
org.hibernate.loader.Loader.list(Loader.java:2141)
org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:416)
org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:1258)
org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
com.action.dbwj.FileUploadAction.execute(FileUploadAction.java:64)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440)
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.inter