I am getting a Stream already closed exception when i fetch a long column. Here are some points to note:-
1] I am not using any join
2] The long column appears last in the query
3] Hibernate version is 3.2
4] Mapping file as follows:-
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="false">
<class name="abc.xyz.Product" table="PGB_MST_PRODUCT">
<composite-id name="id" class="abc.xyz.ProductId">
<key-property name="productId" type="string">
<column name="PRODUCT_ID" length="40" />
</key-property>
<key-property name="locale" type="string">
<column name="LOCALE" length="6" />
</key-property>
</composite-id>
<property name="displayName" type="string">
<column name="DISPLAY_NAME" length="254" />
</property>
<property name="description" type="string">
<column name="DESCRIPTION" length="254" />
</property>
<property name="longDescription" type="string">
<column name="LONG_DESCRIPTION" length="0" />
</property>
<set name="prdMediaRel" inverse="true" lazy="true">
<key>
<column name="PRODUCT_ID" length="40" not-null="true" />
<column name="LOCALE" length="6" not-null="true" />
</key>
<one-to-many class="abc.xyz.PrdMediaRel" />
</set>
<set name="catChildPrdRel" inverse="true" lazy="true">
<key>
<column name="CHILD_PRD_ID" length="40" not-null="true" />
<column name="LOCALE" length="6" not-null="true" />
</key>
<one-to-many class="abc.xyz.CatChildPrdRel" />
</set>
<set name="prdChildSkuRel" inverse="true" lazy="true">
<key>
<column name="PRODUCT_ID" length="40" not-null="true" />
<column name="LOCALE" length="6" not-null="true" />
</key>
<one-to-many class="abc.xyz.PrdChildSkuRel" />
</set>
</class>
</hibernate-mapping>
5] The debug log with the Hibernate query in bold.
2007-06-01 18:48:52,597 DEBUG [org.hibernate.jdbc.AbstractBatcher] - <about to open PreparedStatement (open PreparedStatements: 0, globally: 0)>
2007-06-01 18:48:52,597 DEBUG [org.hibernate.SQL] - <select product0_.PRODUCT_ID as PRODUCT1_4_0_, product0_.LOCALE as LOCALE4_0_, product0_.DISPLAY_NAME as DISPLAY3_4_0_, product0_.DESCRIPTION as DESCRIPT4_4_0_, product0_.LONG_DESCRIPTION as LONG5_4_0_ from PGB_MST_PRODUCT product0_ where product0_.PRODUCT_ID=? and product0_.LOCALE=?>
Hibernate:
select product0_.PRODUCT_ID as PRODUCT1_4_0_, product0_.LOCALE as LOCALE4_0_, product0_.DISPLAY_NAME as DISPLAY3_4_0_, product0_.DESCRIPTION as DESCRIPT4_4_0_, product0_.LONG_DESCRIPTION as LONG5_4_0_ from PGB_MST_PRODUCT product0_ where product0_.PRODUCT_ID=? and product0_.LOCALE=?
2007-06-01 18:48:52,597 DEBUG [org.hibernate.jdbc.AbstractBatcher] - <preparing statement>
2007-06-01 18:48:52,597 DEBUG [com.mchange.v2.c3p0.stmt.GooGooStatementCache] - <CULLING: select prdmediare0_.PRODUCT_ID as PRODUCT1_1_, prdmediare0_.LOCALE as LOCALE1_, prdmediare0_.MEDIA_ID as MEDIA3_1_, prdmediare0_.PRODUCT_ID as PRODUCT1_11_0_, prdmediare0_.LOCALE as LOCALE11_0_, prdmediare0_.MEDIA_ID as MEDIA3_11_0_, prdmediare0_.MEDIA_TYPE as MEDIA4_11_0_ from PGB_RLT_PRD_MEDIA prdmediare0_ where prdmediare0_.PRODUCT_ID=? and prdmediare0_.LOCALE=?>
2007-06-01 18:48:52,597 DEBUG [com.mchange.v2.c3p0.stmt.GooGooStatementCache] - <cxnStmtMgr.statementSet( oracle.jdbc.driver.T4CConnection@ac97cc ).size(): 3>
2007-06-01 18:48:52,597 DEBUG [com.mchange.v2.c3p0.stmt.GooGooStatementCache] - <checkoutStatement: com.mchange.v2.c3p0.stmt.PerConnectionMaxOnlyStatementCache stats -- total size: 9; checked out: 1; num connections: 3; num keys: 9>
2007-06-01 18:48:52,597 DEBUG [org.hibernate.type.StringType] - <binding 'prod10010' to parameter: 1>
2007-06-01 18:48:52,597 DEBUG [org.hibernate.type.StringType] - <binding 'en_US' to parameter: 2>
2007-06-01 18:48:52,597 DEBUG [org.hibernate.jdbc.AbstractBatcher] - <about to open ResultSet (open ResultSets: 0, globally: 0)>
2007-06-01 18:48:52,612 DEBUG [org.hibernate.loader.Loader] - <processing result set>
2007-06-01 18:48:52,612 DEBUG [org.hibernate.loader.Loader] - <result set row: 0>
2007-06-01 18:48:52,612 DEBUG [org.hibernate.loader.Loader] - <result row: EntityKey[abc.xyz..Product#component[productId,locale]{locale=en_US, productId=prod10010}]>
2007-06-01 18:48:52,612 DEBUG [org.hibernate.loader.Loader] - <Initializing object from ResultSet: [abc.xyz.Product#component[productId,locale]{locale=en_US, productId=prod10010}]>
2007-06-01 18:48:52,612 DEBUG [org.hibernate.persister.entity.AbstractEntityPersister] - <Hydrating entity: [abc.xyz..Product#component[productId,locale]{locale=en_US, productId=prod10010}]>
2007-06-01 18:48:52,612 DEBUG [org.hibernate.type.StringType] - <returning 'Spic and Span All-Purpose Cleaner--Non-phosphate' as column: DISPLAY3_4_0_>
2007-06-01 18:48:52,612 DEBUG [org.hibernate.type.StringType] - <returning 'Spic and Span All-Purpose Cleaner' as column: DESCRIPT4_4_0_>
2007-06-01 18:48:52,644 DEBUG [com.mchange.v2.c3p0.impl.NewPooledConnection] - <com.mchange.v2.c3p0.impl.NewPooledConnection@114a306 handling a throwable.>
java.sql.SQLException: Stream has already been closed at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
at oracle.jdbc.driver.LongAccessor.getBytes(LongAccessor.java:151)
at oracle.jdbc.driver.LongAccessor.getString(LongAccessor.java:193)
at oracle.jdbc.driver.T4CLongAccessor.getString(T4CLongAccessor.java:422)
at oracle.jdbc.driver.OracleResultSetImpl.getString(OracleResultSetImpl.java:397)
at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1515)
at com.mchange.v2.c3p0.impl.NewProxyResultSet.getString(NewProxyResultSet.java:3342)
at org.hibernate.type.StringType.get(StringType.java:18)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:163)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:154)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2092)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1371)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1299)
at org.hibernate.loader.Loader.getRow(Loader.java:1197)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:568)
at org.hibernate.loader.Loader.doQuery(Loader.java:689)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1851)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3038)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:395)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:98)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
at org.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:836)
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:66)
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:140)
at abc.xyz.Product$$EnhancerByCGLIB$$60148399.getDisplayName(<generated>)
at sun.reflect.GeneratedMethodAccessor95.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1773)
at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1132)
at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:686)
at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:715)
at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:290)
at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:880)
at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:233)
at org.apache.jsp.en_005fUS.pages.sub_002dcategory_jsp._jspx_meth_bean_write_15(sub_002dcategory_jsp.java:1065)
at org.apache.jsp.en_005fUS.pages.sub_002dcategory_jsp._jspService(sub_002dcategory_jsp.java:573)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:704)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:474)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:409)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1078)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:396)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:232)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:183)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
Can someone help me in here? I read through the forums for such exception, however my case is different, in this case the query doesn't use join and also the long column is last in the query.
Thanks for help.