ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Toshiaki Takashima <tak...@jp.fujitsu.com>
Subject Re: should "parameterClass" be specified in map xml?
Date Thu, 08 Dec 2005 03:37:50 GMT
hi,

> Larry

 thank for your response.


> Are you getting a SQLException?

I get Exception when executing insert statement
with setting "name"  parameter to null such as : 

com.ibatis.common.jdbc.exception.NestedSQLException

--- The error occurred in Map.xml.
--- The error occurred while applying a parameter map.
--- Check the insertBu-InlineParameterMap.
--- Check the parameter mapping for the 'name' property.
--- Cause: java.sql.SQLException: parameter number is wrong
Caused by: java.sql.SQLException: parameter number is wrong




thanks,


> 
> Larry
> 
> 
> On 12/7/05, Toshiaki Takashima <taka-t@jp.fujitsu.com> wrote:
> > Hi there
> >
> > I defined sql Map definition for select statement
> > as follows :
> >
> >
> >  <select id="getBgList" resultClass="Result">
> >     SELECT
> >       SEQNO  as seqNo,
> >       NAME   as name
> >     FROM testtable
> >     WHERE
> >       NME like #paraName#
> >  </select>
> >
> > This Statement works, but following insert statement
> > fails when null(java) value is specified to any parameters
> > even if you use valid Bean Class which has correct
> > properties :
> >
> >  <statement>
> >    INSERT INTO testtable
> >    VALUES (
> >      #seqNo#,
> >      #name#
> >    )
> >  </statement>
> >
> > But statement below works fine even if null parameters are
> > contained :
> >
> >  <statement parameterClass="Parameter">
> >    INSERT INTO testtable
> >    VALUES (
> >      #seqNo#,
> >      #name#
> >    )
> >  </statement>
> >
> >
> >
> >
> > So, I wonder I must specify parameterMap or parameterClass for
> > every SQL Map definition.
> >
> >
> > I thought it is just a performance issue for whether you should
> > specify parameterMap / parameter Class or not.
> >
> > Should I always specify parameterMap / parameterClass attribute?
> >
> > Please teach me !
> >
> >
> > thanks,
> >
> >
> >
> >


---------------------------------------------------------
第二ソリューションビジネス統括部・第一ソリューション部

高島俊昭
mailto:taka-t@jp.fujitsu.com
内線  :7576-4406

株式会社富山富士通
〒939-2392 富山県婦負郡八尾町保内2-2-1
TEL 076-455-3131
FAX 076-455-0935
---------------------------------------------------------



Mime
View raw message