OK, here's the deal. When I run this program command line, or a few days ago, it worked fine. The Blob was converted to a Java blob, and it was fine. Since then I mapped another class CmsNoContent to the same table with the exception that the blob is not mapped (for queries), and now it tries to get the Blob column as a SerializableType (not Blob), and it throws this exception obviously. Why does Hibernate not read the column as SerializableType and not Blob. Is there a way to force it to use Blob (I added the type="blob" in the mapping file, but it didnt work.
Thanks!
Chris
Hibernate version:
2.1
Mapping documents:
I have a blob mapped as a blob:
<property name="contentFastBlob" column="CONTENT" type="blob"/>
Code between sessionFactory.openSession() and session.close():
This is wrapped by a lot of code, but basically:
hibQuery.list()
Full stack trace of any exception that occurs:
java.io.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
at net.sf.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:189)
at net.sf.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:220)
at net.sf.hibernate.type.SerializableType.fromBytes(SerializableType.java:73)
at net.sf.hibernate.type.SerializableType.get(SerializableType.java:38)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:53)
at net.sf.hibernate.type.AbstractType.hydrate(AbstractType.java:66)
at net.sf.hibernate.loader.Loader.hydrate(Loader.java:611)
at net.sf.hibernate.loader.Loader.loadFromResultSet(Loader.java:552)
at net.sf.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:511)
at net.sf.hibernate.loader.Loader.getRow(Loader.java:426)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:209)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:955)
at net.sf.hibernate.loader.Loader.list(Loader.java:946)
at net.sf.hibernate.loader.SQLLoader.list(SQLLoader.java:92)
at net.sf.hibernate.impl.SessionImpl.findBySQL(SessionImpl.java:3802)
at net.sf.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:52)
at edu.upenn.isc.fast.hibernate.HibernateSession.retrieveObjectsBySql(HibernateSession.java:1327)
at edu.upenn.isc.fast.hibernate.HibernateSession.retrieveObjectBySql(HibernateSession.java:1203)
at edu.upenn.isc.fast.hibernate.HibernateSession.retrieveObjectBySql(HibernateSession.java:1183)
at edu.upenn.isc.fast.hibernate.HibernateSession.retrieveObjectBySqlStatic(HibernateSession.java:1393)
at edu.upenn.isc.fast.hibernate.HibernateSession.retrieveObjectBySqlStatic(HibernateSession.java:1411)
at edu.upenn.isc.fast.Cms.retrieveLatestRevision(Cms.java:104)
at edu.upenn.isc.fast.Cms.cmsDownload(Cms.java:351)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at edu.upenn.isc.fast.beans.objectModel.TransactionBean.executeJava(TransactionBean.java:387)
at edu.upenn.isc.fast.FastController.callNavClassMethod(FastController.java:1106)
at edu.upenn.isc.fast.FastController.findProjectHooksAfterBizLogic(FastController.java:1285)
at edu.upenn.isc.fast.FastController.doGet(FastController.java:2162)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:534)
Name and version of the database you are using:
Oracle 9i
The generated SQL (show_sql=true):
1111910733417|0|0|statement|select cmsContent.CONTENT_ID as CONTENT_ID0_, cmsContent.LAST_EDITED as LAST_EDI2_0_, cmsContent.FILE_CODE as FILE_CODE0_, cmsContent.FILE_NAME as FILE_NAME0_, cmsContent.FILE_TITLE as FILE_TITLE0_, cmsContent.CREATED_DATE as CREATED_6_0_, cmsContent.DISABLED_DATE as DISABLED7_0_, cmsContent.LAST_USER_EDITED as LAST_USE8_0_, cmsContent.CONTENT_MODULE as CONTENT_9_0_, cmsContent.REVISION_ID as REVISIO10_0_, cmsContent.CONTENT as CONTENT0_, cmsContent.FILE_COMMENT as FILE_CO12_0_ from Fast_Cms_Content cmsContent where cmsContent.file_Code = ? and cmsContent.revision_Id = ?|select cmsContent.CONTENT_ID as CONTENT_ID0_, cmsContent.LAST_EDITED as LAST_EDI2_0_, cmsContent.FILE_CODE as FILE_CODE0_, cmsContent.FILE_NAME as FILE_NAME0_, cmsContent.FILE_TITLE as FILE_TITLE0_, cmsContent.CREATED_DATE as CREATED_6_0_, cmsContent.DISABLED_DATE as DISABLED7_0_, cmsContent.LAST_USER_EDITED as LAST_USE8_0_, cmsContent.CONTENT_MODULE as CONTENT_9_0_, cmsContent.REVISION_ID as REVISIO10_0_, cmsContent.CONTENT as CONTENT0_, cmsContent.FILE_COMMENT as FILE_CO12_0_ from Fast_Cms_Content cmsContent where cmsContent.file_Code = 'OB8MEC8I' and cmsContent.revision_Id = 2
|