Hello all,
After i(literally) read every post about "could not initialize collection:" and couldn't find anything like my problem i decided to ask if any of have a clue about it.
What seems to be the problem is the big size of the query hibernate is generating (about 11000 chars) and the stacktrace starts with a SQLException.
Running the generated query using sqlplus works only if i format it so to break it into many rows.
I am using
Hibernate version: 2.1
Mapping documents:
I try to represent inheritance and the type that matches my structure is like
<class name="[package].Document" table="document">
....properties, sets, maps
<joined-subclass name="[package].Invoice" table="invoice">
....attributes, sets, maps
<joined-subclass name="[package].ClientInvoice" table="clientInvoice">
....attributes, sets, maps
</joined-subclass>
<joined-subclass name="[package].SupplierInvoice" table="supplierInvoice">
....attributes, sets, maps
</joined-subclass>
</joined-subclass>
<joined-subclass>
....attributes, sets, maps
</joined-subclass>
<joined-subclass>
....attributes, sets, maps
</joined-subclass>
</class>
this mapping works fine when working with the subclasses individually
like
<class name="[package].SupplierInvXIndemnification" table="SupplierInvXIndemnification">
....properties, sets, maps
<many-to-one name ="supplierInvoice" column ="supplierInvoiceId"/>
</class>
but when i do this
<class name="[package].MovimientoDocumentoCartera" table="movimientoDocumentoCartera">
....properties, sets, maps
<many-to-one name ="document" column ="documentId"/>
</class>
it fails with the following stacktrace
Full stack trace of any exception that occurs:
2005-02-25 10:04:15,681 [main] WARN net.sf.hibernate.util.JDBCExceptionReporter - SQL Error: 17059, SQLState: null
2005-02-25 10:04:15,681 [main] ERROR net.sf.hibernate.util.JDBCExceptionReporter - Fallo al convertir a representación interna
2005-02-25 10:04:15,691 [main] WARN net.sf.hibernate.util.JDBCExceptionReporter - SQL Error: 17059, SQLState: null
2005-02-25 10:04:15,691 [main] ERROR net.sf.hibernate.util.JDBCExceptionReporter - Fallo al convertir a representación interna
2005-02-25 10:04:15,691 [main] ERROR net.sf.hibernate.util.JDBCExceptionReporter - could not initialize collection: [tesoreria.TransaccionAdministrativa.movimientosDocumentosCartera#18436521986]
java.sql.SQLException: Fallo al convertir a representación interna
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleStatement.getLongValue(OracleStatement.java:4367)
at oracle.jdbc.driver.OracleResultSetImpl.getLong(OracleResultSetImpl.java:529)
at oracle.jdbc.driver.OracleResultSet.getLong(OracleResultSet.java:1540)
at net.sf.hibernate.type.LongType.get(LongType.java:18)
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:686)
at net.sf.hibernate.loader.Loader.loadFromResultSet(Loader.java:627)
at net.sf.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:586)
at net.sf.hibernate.loader.Loader.getRow(Loader.java:501)
at net.sf.hibernate.loader.Loader.getRowFromResultSet(Loader.java:213)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:281)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:990)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:965)
at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.java:93)
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:284)
at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3268)
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:195)
at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71)
at net.sf.hibernate.collection.Set.iterator(Set.java:130)
at indemnizaciones.IndemnizacionPago.poblarRubros(IndemnizacionPago.java:80)
at contabilidad.ContabilizableEnsurance.poblarRubros(ContabilizableEnsurance.java:35)
at tandi.contabilidad.caso.ContabilizablePorCaso.contabilizar(ContabilizablePorCaso.java:44)
at tandi.test.ensurance.indemnizaciones.IndemnizacionTest.testIncrementoReserva(IndemnizacionTest.java:45)
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:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(IdeaJUnitAgent.java:57)
at junit.textui.TestRunner.start(TestRunner.java:172)
at com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(TextTestRunner2.java:23)
at com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:97)
at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
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:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
2005-02-25 10:04:15,711 [main] ERROR net.sf.hibernate.collection.PersistentCollection - Failed to lazily initialize a collection
net.sf.hibernate.JDBCException: could not initialize collection: [tesoreria.TransaccionAdministrativa.movimientosDocumentosCartera#18436521986]
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:287)
at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3268)
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:195)
at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71)
at net.sf.hibernate.collection.Set.iterator(Set.java:130)
at indemnizaciones.IndemnizacionPago.poblarRubros(IndemnizacionPago.java:80)
at contabilidad.ContabilizableEnsurance.poblarRubros(ContabilizableEnsurance.java:35)
at tandi.contabilidad.caso.ContabilizablePorCaso.contabilizar(ContabilizablePorCaso.java:44)
at tandi.test.ensurance.indemnizaciones.IndemnizacionTest.testIncrementoReserva(IndemnizacionTest.java:45)
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:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(IdeaJUnitAgent.java:57)
at junit.textui.TestRunner.start(TestRunner.java:172)
at com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(TextTestRunner2.java:23)
at com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:97)
at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
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:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
Caused by: java.sql.SQLException: Fallo al convertir a representación interna
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleStatement.getLongValue(OracleStatement.java:4367)
at oracle.jdbc.driver.OracleResultSetImpl.getLong(OracleResultSetImpl.java:529)
at oracle.jdbc.driver.OracleResultSet.getLong(OracleResultSet.java:1540)
at net.sf.hibernate.type.LongType.get(LongType.java:18)
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:686)
at net.sf.hibernate.loader.Loader.loadFromResultSet(Loader.java:627)
at net.sf.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:586)
at net.sf.hibernate.loader.Loader.getRow(Loader.java:501)
at net.sf.hibernate.loader.Loader.getRowFromResultSet(Loader.java:213)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:281)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:990)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:965)
at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.java:93)
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:284)
... 31 more
Name and version of the database you are using:
oracle 9i
|