我正在使用密钥从表中检索某些数据.
我正在使用hibernate查询来检索数据.
我能够检索特定密钥的数据.但对于其他一些键,我会收到错误或异常.我得到的例外是
[1/17/13 14:07:41:819 IST] 0000004c LongType I **org.hibernate.type.NullableType nullSafeGet could not read column value from result set: BRAND1_23_2_; [jcc][t4][10120][10898][3.58.81] Invalid operation: result set is closed. ERRORCODE=-4470, SQLSTATE=null** [1/17/13 14:07:41:822 IST] 0000004c JDBCException W org.hibernate.util.JDBCExceptionReporter logExceptions SQL Error: -4470, SQLState: null [1/17/13 14:07:41:823 IST] 0000004c JDBCException E org.hibernate.util.JDBCExceptionReporter logExceptions [jcc][t4][10120][10898][3.58.81] Invalid operation: result set is closed. ERRORCODE=-4470, SQLSTATE=null [1/17/13 14:07:41:826 IST] 0000004c DefaultLoadEv I org.hibernate.event.def.DefaultLoadEventListener onl oad Error performing load command org.hibernate.exception.GenericJDBCException: could not load an entity: [com.travelport.soa.gds.airline.brandedfares.entity.FareCollection#490] at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
解决方法:
您获取了一个具有Java中表示的一对多关系的实体作为延迟加载的Collection,并且在您已经关闭了已获取该对象的Hibernate会话之后,您尝试迭代该集合.您必须急切地获取集合或扩展会话边界以包含迭代代码.