ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Hall" <JH...@cihi.ca>
Subject Error processing Null during Insert statement - Help
Date Thu, 26 May 2005 17:12:41 GMT
Hi,

I'm trying to force a null in a nullable column and i get an error.

Java code:
Dummy d = new Dummy();
d.setId(-999);
sqlMap.insert("Dummy.insertDummy",d);



Sql Map:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">

<sqlMap namespace="Dummy">

<parameterMap id="paramMap" class="ca.cihi.omhrs.Dummy" >
  <parameter property="id"  jdbcType="NUMBER" nullValue="-999" />
  <parameter property="name" jdbcType="VARCHAR" nullValue="NO_ENTRY" />
</parameterMap>

<insert id="insertDummy" parameterMap="paramMap">

insert into Dummy(id,name)
values(?,?)
</insert>

<!--
<insert id="insertDummy" parameterClass="ca.cihi.omhrs.Dummy">

insert into Dummy(id,name)
values(#id:NUMERIC:#,#name:VARCHAR:NO_ENTRY#)
</insert>
-->

</sqlMap>
 




I get the following error:

com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in ca/cihi/omhrs/persistence/datamap/Dummy.xml.  
--- The error occurred while applying a parameter map.  
--- Check the Dummy.paramMap.  
--- Check the parameter mapping for the 'id' property.  
--- Cause: java.sql.SQLException: General error
Caused by: java.sql.SQLException: General error
	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:87)
	at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:442)
	at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:85)
	at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.insert(SqlMapClientImpl.java:57)
	at ca.cihi.omhrs.TestIbatis.main(TestIbatis.java:121)

Caused by: 
java.sql.SQLException: General error
	at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6060)
	at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6188)
	at sun.jdbc.odbc.JdbcOdbc.SQLBindInParameterNull(JdbcOdbc.java:922)
	at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setNull(JdbcOdbcPreparedStatement.java:359)
	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:196)
	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:74)
	at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:442)
	at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:85)
	at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.insert(SqlMapClientImpl.java:57)
	at ca.cihi.omhrs.TestIbatis.main(TestIbatis.java:121)


Mime
View raw message