ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niels Beekman" <n.beek...@wis.nl>
Subject RE: error inserting null values to database
Date Mon, 31 Oct 2005 16:17:52 GMT
http://opensource2.atlassian.com/confluence/oss/display/IBATIS/What+caus
es+an+Invalid+column+type+error+with+Oracle


-----Original Message-----
From: neilhenry@f2s.com [mailto:neilhenry@f2s.com] 
Sent: maandag 31 oktober 2005 17:17
To: user-java@ibatis.apache.org
Subject: error inserting null values to database

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:11
1)
	at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:14
5)
	at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:20
7)
	at
oracle.jdbc.driver.OracleStatement.getInternalType(OracleStatement.java:
3423)
	at
oracle.jdbc.driver.OraclePreparedStatement.setNullCritical(OraclePrepare
dStatement.java:4196)
	at
oracle.jdbc.driver.OraclePreparedStatement.setNull(OraclePreparedStateme
nt.java:4185)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at
com.ibatis.common.jdbc.logging.PreparedStatementLogProxy.invoke(Prepared
StatementLogProxy.java:70)
	at $Proxy1.setNull(Unknown Source)
	at
com.ibatis.sqlmap.engine.mapping.parameter.BasicParameterMap.setParamete
r(BasicParameterMap.java:173)
	at
com.ibatis.sqlmap.engine.mapping.parameter.BasicParameterMap.setParamete
rs(BasicParameterMap.java:125)
	at
com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(SqlExecutor
.java:80)
	at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteUp
date(GeneralStatement.java:200)
	at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdat
e(GeneralStatement.java:78)
	at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecut
orDelegate.java:442)
	at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl
.java:81)
	at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.insert(SqlMapClientImpl.j
ava: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