views:

1202

answers:

3

We are trying to populate a domain object from an oracle 10g database. The field in question is defined as a string in the domain object with the following constraints.

zdata(blank:false,maxSize:3000000)

The size of the data is approximately 70K of XML.

The table definition looks like this:

ZDATA NOT NULL LONG()

We are using the grails generated getter to access the table:

reportData = ReportData.get(reportDataId)

When making this call we are getting a null pointer exception. Here is a portion of our stack trace. java.lang.NullPointerException at java.lang.String.(String.java:176) at oracle.sql.CharacterSet.AL32UTF8ToString(CharacterSet.java:1518) at oracle.jdbc.driver.DBConversion.CharBytesToString(DBConversion.java:610) at oracle.jdbc.driver.DBConversion.CharBytesToString(DBConversion.java:555) at oracle.jdbc.driver.LongAccessor.getString(LongAccessor.java:217) at oracle.jdbc.driver.T4CLongAccessor.getString(T4CLongAccessor.java:426) at oracle.jdbc.driver.OracleResultSetImpl.getString(OracleResultSetImpl.java:403) at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1515) at org.apache.commons.dbcp.DelegatingResultSet.getString(DelegatingResultSet.java:224) at org.hibernate.type.StringType.get(StringType.java:18) at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:163) at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:154) at org.hibernate.loader.hql.QueryLoader.getResultColumnOrRow(QueryLoader.java:333) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:606) 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.codehaus.groovy.grails.orm.hibernate.metaclass.ExecuteQueryPersistentMethod$1.doInHibernate(ExecuteQueryPersistentMethod.java:94)

we are using oracle driver 10.2.0.3.0.

A: 

Why do you use a long field in Oracle? Long is very obsolete, you should use a clob.

Theo
We were not in charge of the db schema. Just trying to interact with it as it exists...
+1  A: 

This is a known limitation of the oracle jdbc driver as listed in the release notes for version 10.2.0.1.0.

This known limitation has been fixed according to the release notes of Oracle JDBC Driver release 11.1.0.7.0

A: 

If you are storing XML in Oracle, use an XmlType column, which can easily be converted to a CLOB and works wonderfully with the JDBC 10g driver, as that is what we are currently using in our production environment.

Nick