I have a Java 1.6 console app (this is not a web application) running on an AS400. The internals are Hibernate 3.6.10 and Spring 3.2.1. We are using IBM's Java Toolbox jt400 version 6.6.
The app reads several rows from a DB2 database using a very large multitable query (generated by Hibernate) which exceeds 4700 characters in length. At this point it's trying to eagerly initialize a collection which hangs off of the main record. EDIT: Whoops, it looks like it's not data dependent: I deleted the offending record and it promptly failed on the next one.
DEBUG Thread-0 org.hibernate.util.JDBCExceptionReporter - could not initialize a collection: com.myapp.model.MyAppMaster.myAppOwners#36
java.sql.SQLException: Internal driver error.(908)
at java.lang.Throwable.<init>(Throwable.java:196)
at java.lang.Exception.<init>(Exception.java:41)
at java.sql.SQLException.<init>(SQLException.java:52)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:480)
at com.ibm.as400.access.SQLDataFactory.newData(SQLDataFactory.java:602)
at com.ibm.as400.access.JDServerRow.initialize(JDServerRow.java:228)
at com.ibm.as400.access.JDServerRow.<init>(JDServerRow.java:106)
at com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.java:1385)
at com.ibm.as400.access.AS400JDBCPreparedStatement.<init>(AS400JDBCPreparedStatement.java:256)
at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1881)
at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1711)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
at net.bull.javamelody.HibernateBatcherFactory$HibernateBatchingBatcher.prepareQueryStatement(HibernateBatcherFactory.java:71)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1700)
at org.hibernate.loader.Loader.doQuery(Loader.java:801)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
at org.hibernate.loader.Loader.loadCollection(Loader.java:2166)
at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:62)
at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:627)
at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:83)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1863)
at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:479)
at org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:900)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:279)
at org.hibernate.loader.Loader.doList(Loader.java:2542)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
at org.hibernate.loader.Loader.list(Loader.java:2271)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:459)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:365)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:246)
[snip]
Shouldn't it simply just return an empty result list? Has anybody run into this before? This is new behavior - this code used to work, but this is a new version (however, none of this should have changed.)
A quick peek at the newData
method of SQLDataFactory.java seems to indicate an invalid native data type:
/**
Return a SQLData object corresponding to the
specific IBM i native type string.
@param nativeType An IBM i native type.
@param length Length of data (in bytes).
@param precision Precision of data.
@param scale Scale of data.
@param settings The conversion settings.
@return A SQLData object.
@exception SQLException If no valid type can be
mapped.
**/
I would update to the latest version of the library and see if that fixes the issue.