Henry,

Yes, they are usually smart enough for casting to the appropriate
type. But it's not good to rely on this every time you need to do
something like Jason is. Type casts can make harder to figure out some
errors.

Jason, let me know if using Oracle's driver worked for you.

Cheers,
Daniel Silva.



On 5/26/05, Henry Lu <[EMAIL PROTECTED]> wrote:
> You know, ORACLE/SQL Server are smart enough to do the data conversion
> for most data types.
> 
> -Henry
> 
> Jason Hall wrote:
> 
> >This works, but doesn't makes sense why since my column is a NUMBER data 
> >type.
> >
> >Does JDBC-ODBC driver be the problem on Oracle 9i?
> >
> >-----Original Message-----
> >From: Henry Lu [mailto:[EMAIL PROTECTED]
> >Sent: Thursday, May 26, 2005 1:30 PM
> >To: ibatis-user-java@incubator.apache.org
> >Subject: Re: Error processing Null during Insert statement - Help
> >
> >
> >Change NUMBER to varchar will take care the business.
> >
> ><parameterMap id="paramMap" class="ca.cihi.omhrs.Dummy" >
> >   <parameter property="id"  jdbcType="VARCHAR" nullValue="-999" />
> >   <parameter property="name" jdbcType="VARCHAR" nullValue="NO_ENTRY" />
> ></parameterMap>
> >
> >-Henry
> >
> >Jason Hall wrote:
> >
> >
> >
> >>All the columns in table dummy are nullable in Oracle
> >>
> >>-----Original Message-----
> >>From: Daniel Henrique Ferreira e Silva [mailto:[EMAIL PROTECTED]
> >>Sent: Thursday, May 26, 2005 1:22 PM
> >>To: ibatis-user-java@incubator.apache.org
> >>Subject: Re: Error processing Null during Insert statement - Help
> >>
> >>
> >>Hi Jason,
> >>
> >>Looking at the stack trace you posted, it's clear that the error
> >>you're getting comes from your DB.
> >>Look at your table Dummy structure. Does it allow the column id to be null?
> >>Also, what is your DB?
> >>
> >>Hope that helped.
> >>
> >>Cheers,
> >>Daniel Silva.
> >>
> >>
> >>On 5/26/05, Jason Hall <[EMAIL PROTECTED]> wrote:
> >>
> >>
> >>
> >>
> >>>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)
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >>
> >>
> >
> >
> >
> >
>

Reply via email to