ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neilhe...@f2s.com
Subject error inserting null values to database
Date Mon, 31 Oct 2005 16:16:46 GMT
Hi

I'm having trouble inserting null values into my database.

The table allows nulls but when I supply a parameterMap with null values in it I
get the folloing exception:

java.sql.SQLException: Invalid column type
	at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
	at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
	at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:207)
	at
oracle.jdbc.driver.OracleStatement.getInternalType(OracleStatement.java:3423)
	at
oracle.jdbc.driver.OraclePreparedStatement.setNullCritical(OraclePreparedStatement.java:4196)
	at
oracle.jdbc.driver.OraclePreparedStatement.setNull(OraclePreparedStatement.java:4185)
	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.ibatis.common.jdbc.logging.PreparedStatementLogProxy.invoke(PreparedStatementLogProxy.java:70)
	at $Proxy1.setNull(Unknown Source)
	at
com.ibatis.sqlmap.engine.mapping.parameter.BasicParameterMap.setParameter(BasicParameterMap.java:173)
	at
com.ibatis.sqlmap.engine.mapping.parameter.BasicParameterMap.setParameters(BasicParameterMap.java:125)
	at
com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(SqlExecutor.java:80)
	at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteUpdate(GeneralStatement.java:200)
	at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:78)
	at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:442)
	at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:81)
	at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.insert(SqlMapClientImpl.java:58)

If I specify a values it works fine.

Any ideas what is going wrong?

I could put dynamic sql round each value going into the insert statement but
this seems a little clunky (as I wounld need to do it for about 20 columns!)

Mime
View raw message