1 Reply Latest reply on Sep 30, 2009 11:52 AM by Peter Johnson

    NullPointerException using BLOBs with DB2 (Hibernate EJB3)

    Alexander Hartner Expert

      When trying to read a entity containing a BLOB from DB2 I get a NullPointerException. I haven't quite narrowed the exact size limit down, but it's about at 1MB. Content smaller then this barrier and there is no problem. My guess is that this is some strange driver issue, but searching the web has not produced any results. Using the same application with SQL Server 2005 works fine. I am using JBoss 4.2.3 with DB2 9.5. The type 4 driver breaks DB2 and causes it to shutdown, so I am using the type 2 driver.

      Any suggestion on what I could do to further narrow down are welcome.

      Thanks in advance
      Alex

      java.lang.NullPointerException
      at com.ibm.db2.jcc.uw.UWConnection.a(UWConnection.java:959)
      at com.ibm.db2.jcc.a.p.e(p.java:281)
      at com.ibm.db2.jcc.t4.a.e(a.java:451)
      at com.ibm.db2.jcc.a.gl.a(gl.java:4792)
      at com.ibm.db2.jcc.a.eg.a(eg.java:292)
      at com.ibm.db2.jcc.a.eg.b(eg.java:248)
      at com.ibm.db2.jcc.a.ce.a(ce.java:277)
      at com.ibm.db2.jcc.a.be.getBytes(be.java:99)
      at com.ibm.db2.jcc.a.ce.getBytes(ce.java:136)
      at org.hibernate.type.ByteArrayBlobType.get(ByteArrayBlobType.java:90)
      at org.hibernate.type.AbstractLobType.nullSafeGet(AbstractLobType.java:46)
      at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
      at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2096)
      at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
      at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
      at org.hibernate.loader.Loader.getRow(Loader.java:1206)
      at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
      at org.hibernate.loader.Loader.doQuery(Loader.java:701)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
      at org.hibernate.loader.Loader.doList(Loader.java:2220)
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
      at org.hibernate.loader.Loader.list(Loader.java:2099)
      at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
      at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
      at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
      at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
      at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
      at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)