Hi Guys,
I'm strugling to get this part of my application to work properly. Oracle driver just won't load entities holding long columns. I get
Quote:
Stream has already been closed
exceptions. This only happens when there's actually data in that column. When this column is null, then the entity loads fine.
If you look at the mapping file, there is a mapping called
workgroupText64kB. this is the one that's causing the exception
I've downloaded the latest oracle driver (checking the manifest, it's version 10.2.0.1.0)
this worked better then 10.1 because on 10.1 i can't even load the entity even though the column was null.
The mapping file below is a generated file from our product. it suppose to be correct.
I've searched everywhere on this forum, I'm not the only one that has this problem, but nobody had posted any answers that helped.
I can't change the database or column to another type because it's the database of our product and i'm just developing a migration tool for it.
Any help is greatly appreciated,
thanks in advance,
Max
Hibernate version: 3.1
Mapping documents:
<?xml version="1.0" encoding="UTF-8"?>
Code:
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.hp.ov.sd.migration.model.servicedesk.spi">
<class name="WorkgroupV45Bean" polymorphism="explicit" table="itsm_workgroups">
<id column="wog_oid" name="objectId" unsaved-value="0"/>
<property column="wog_lockseq" name="lockseq"/>
<many-to-one class="com.hp.ov.sd.migration.model.objectserverkernel.spi.TemplateV45Bean" column="wog_tem_oid" name="template" not-null="false" outer-join="true"/>
<property column="wog_modified" name="modified"/>
<property column="wog_notselectable" name="workgroupNotSelectable"/>
<property column="reg_created_by_oid" name="createdby"/>
<many-to-one class="com.hp.ov.sd.migration.model.servicedesk.spi.OpeningsScheduleV45Bean" column="wog_osc_oid" name="openingHours" not-null="false" outer-join="true"/>
<property column="wog_created" name="created"/>
<property column="reg_modified_by_oid" name="modifiedBy"/>
<property column="wog_attachment_exists" name="attachmentExists"/>
<many-to-one class="com.hp.ov.sd.migration.model.objectserverkernel.spi.FolderV45Bean" column="wog_poo_oid" name="folder" not-null="false" outer-join="true"/>
<many-to-one class="com.hp.ov.sd.migration.model.servicedesk.spi.HolidayCalendarV45Bean" column="wog_hcr_oid" name="holidays" not-null="false" outer-join="true"/>
<property column="wog_name" name="name"/>
<property column="wog_sourceid" name="sourceID"/>
<many-to-one class="com.hp.ov.sd.migration.model.servicedesk.spi.WorkgroupV45Bean" column="wog_parent" name="parentWorkgroup" not-null="false" outer-join="true"/>
<many-to-one class="com.hp.ov.sd.migration.model.objectserverkernel.spi.TimeZonesV45Bean" column="wog_tmz_oid" name="timeZone" not-null="false" outer-join="true"/>
<many-to-one class="com.hp.ov.sd.migration.model.servicedesk.spi.StatusWgV45Bean" column="wog_sta_oid" name="status" not-null="false" outer-join="true"/>
<property column="wog_searchcode" name="searchcode"/>
<many-to-one class="com.hp.ov.sd.migration.model.servicedesk.spi.PersonV45Bean" column="slc_wog_per_oid" name="enteredByPerson" not-null="false" outer-join="true"/>
<join optional="true" table="itsm_wog_custom_fields">
<key column="wgc_wog_oid"/>
<many-to-one class="com.hp.ov.sd.migration.model.servicedesk.spi.WorkgroupCode1V45Bean" column="wgc_cod1_oid" name="workgroupCode1" not-null="false" outer-join="true"/>
<property column="wgc_workgroupshorttext3" name="workgroupShorttext3"/>
<property column="wgc_workgroupshorttext1" name="workgroupShorttext1"/>
<property column="wgc_workgroupdate4" name="workgroupDate4"/>
<many-to-one class="com.hp.ov.sd.migration.model.servicedesk.spi.PersonV45Bean" column="wgc_per1_oid" name="workgroupPerson1" not-null="false" outer-join="true"/>
<property column="wgc_workgroupdate3" name="workgroupDate3"/>
<property column="wgc_boolean4" name="wogBoolean4"/>
<property column="wgc_workgroupshorttext4" name="workgroupShorttext4"/>
<property column="wgc_workgroupdate2" name="workgroupDate2"/>
<property column="wgc_boolean6" name="wogBoolean6"/>
<property column="wgc_workgroupdate1" name="workgroupDate1"/>
<many-to-one class="com.hp.ov.sd.migration.model.servicedesk.spi.WorkgroupCode3V45Bean" column="wgc_cod3_oid" name="workgroupCode3" not-null="false" outer-join="true"/>
<property column="wgc_workgrouptext4" name="workgroupText4"/>
<many-to-one class="com.hp.ov.sd.migration.model.servicedesk.spi.WorkgroupCode5V45Bean" column="wgc_cod5_oid" name="workgroupCode5" not-null="false" outer-join="true"/>
<property column="wgc_boolean8" name="wogBoolean8"/>
<property column="wgc_workgroupnumber2" name="workgroupNumber2"/>
<property column="wgc_workgroupnumber1" name="workgroupNumber1"/>
<property column="wgc_workgrouptext5" name="workgroupText5"/>
<property column="wgc_workgroupnumber3" name="workgroupNumber3"/>
<property column="wgc_boolean9" name="wogBoolean9"/>
<property column="wgc_workgrouptext64kb" name="workgroupText64kB"/>
<property column="wgc_duration1" name="wogDuration1"/>
<property column="wgc_boolean7" name="wogBoolean7"/>
<property column="wgc_workgroupdate5" name="workgroupDate5"/>
<property column="wgc_boolean2" name="wogBoolean2"/>
<property column="wgc_workgroupnumber4" name="workgroupNumber4"/>
<property column="wgc_boolean1" name="wogBoolean1"/>
<property column="wgc_workgroupshorttext2" name="workgroupShorttext2"/>
<property column="wgc_workgroupnumber5" name="workgroupNumber5"/>
<property column="wgc_duration2" name="wogDuration2"/>
<property column="wgc_workgrouptext1" name="workgroupText1"/>
<many-to-one class="com.hp.ov.sd.migration.model.servicedesk.spi.WorkgroupCode2V45Bean" column="wgc_cod2_oid" name="workgroupCode2" not-null="false" outer-join="true"/>
<many-to-one class="com.hp.ov.sd.migration.model.servicedesk.spi.OrganizationV45Bean" column="wgc_org1_oid" name="workgroupOrganization1" not-null="false" outer-join="true"/>
<property column="wgc_boolean10" name="wogBoolean10"/>
<property column="wgc_boolean5" name="wogBoolean5"/>
<many-to-one class="com.hp.ov.sd.migration.model.servicedesk.spi.ConfigurationItemV45Bean" column="wgc_cit1_oid" name="workgroupCI1" not-null="false" outer-join="true"/>
<property column="wgc_workgrouptext3" name="workgroupText3"/>
<many-to-one class="com.hp.ov.sd.migration.model.servicedesk.spi.WorkgroupCode4V45Bean" column="wgc_cod4_oid" name="workgroupCode4" not-null="false" outer-join="true"/>
<property column="wgc_workgrouptext2" name="workgroupText2"/>
<property column="wgc_boolean3" name="wogBoolean3"/>
<property column="wgc_workgroupshorttext5" name="workgroupShorttext5"/>
</join>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Full stack trace of any exception that occurs:Code:
com.hp.ov.sd.migration.core.command.CommandException: Failed!
at com.hp.ov.sd.migration.migrator.command.DefaultMigrateCommand.run(DefaultMigrateCommand.java:86)
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 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
at com.hp.ov.sd.migration.audit.advices.BatcherAdvice.invoke(BatcherAdvice.java:51)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
at $Proxy392.run(Unknown Source)
at com.hp.ov.sd.migration.core.command.CommandContainer.run(CommandContainer.java:179)
at com.hp.ov.sd.migration.core.command.CommandContainer$SystemContext.run(CommandContainer.java:567)
at com.hp.ov.sd.migration.core.command.AbstractCommand.run(AbstractCommand.java:107)
at com.hp.ov.sd.migration.migrator.MigrateCommand.run(MigrateCommand.java:46)
at com.hp.ov.sd.migration.core.command.CommandContainer.run(CommandContainer.java:179)
at com.hp.ov.sd.migration.core.command.EntryCommand.execute(EntryCommand.java:102)
at com.hp.ov.sd.migration.migrator.MigrateCommand.main(MigrateCommand.java:77)
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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: java.lang.Exception: org.hibernate.exception.GenericJDBCException: could not load an entity: [com.hp.ov.sd.migration.model.servicedesk.spi.WorkgroupV45Bean#281478295388239]
at com.hp.ov.sd.migration.migrator.MigrateHelper.execute(MigrateHelper.java:24)
at com.hp.ov.sd.migration.migrator.command.DefaultMigrateCommand.run(DefaultMigrateCommand.java:84)
... 23 more
Caused by: org.hibernate.exception.GenericJDBCException: could not load an entity: [com.hp.ov.sd.migration.model.servicedesk.spi.WorkgroupV45Bean#281478295388239]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1799)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:47)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:41)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2730)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:365)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:346)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:123)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:177)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:862)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:799)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:792)
at com.hp.ov.sd.migration.model.servicedesk.spi.hibernate.WorkgroupV45BeanHome.findByPrimaryKey(WorkgroupV45BeanHome.java:33)
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 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:165)
at $Proxy358.findByPrimaryKey(Unknown Source)
at com.hp.ov.sd.migration.migrator.command.DefaultMigrateCommand$DefaultMigratorCallBack.next(DefaultMigrateCommand.java:516)
at com.hp.ov.sd.migration.migrator.MigrateHelper.execute(MigrateHelper.java:21)
... 24 more
Caused by: 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 org.hibernate.type.StringType.get(StringType.java:18)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:113)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:102)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:1899)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1372)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1300)
at org.hibernate.loader.Loader.getRow(Loader.java:1197)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:569)
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:1785)
... 45 more
Name and version of the database you are using:
Oracle 9i thin driver 10.2.*
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt: