ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: Question.....
Date Mon, 20 Feb 2006 21:29:18 GMT
You can also use an inline parameter map to specify the field type (I find
this more convenient than using a seperate parameter map). For example:

<insert id="insertAccount">
  insert into account (..., status, ...) values (..., #status:VARCHAR#, ...)
</insert>

This is needed in DB2 whenever a field can be nullable.  Note that this is
true with the type 2 driver for certain.  The type 4 driver may be
different, but I doubt it.

So the simple answer is that you'll need to modify the xml supplied with
JPetStore either way - either with a parameterMap or specifying the inline
parameter map.  You're still using a Java bean, just supplying a little more
information in the SQL map.

Jeff Butler


On 2/20/06, harinder nandyala <harindern@hotmail.com > wrote:
>
>
> I am using WSAD to evaluate on a requirement with DB2 and Websphere
> application server. Started with 'petstore' sample downloaded from ibatis
> web site. Here are the issues noticed in using this sample, import war
> file,
> in this environment as is without making any changes:
>
> When a new user id registered a error was reported -->SQLSTATE=S1003-->
> Program type out of range. On debugging I found that field 'Status' which
> can be nullable in db2 TABLE is the one creating problem. When ibatis
> tries
> to insert a record with 'status' value as 'null' as this is not a user
> entry
> field, ibatis tries to set jdbcType as 0 (zero0 which is not acceptable
> with
> prepared statement when used with DB2 driver. So I have updaed Account.xml
> file with a 'parameterMap' where I declared this field. Then there was no
> problem. So, my questions is how do I make it work without updating *.xml
> file and use simply java bean (ibatis may use reflection mechanism to get
> types and valeus from java bean)? Please note that there is no problem if
> I
> use hsqldb (in memory DB).
>
> Any help is appreciated. Thank you,
>
>
> "The more you strive for humanity, the more civilized you become" -ASHA
>
> Harinder Nandyala
> http://www.ashakiran.org
>
>
>

Mime
View raw message