No version of iBATIS has ever actively converted types.  If it worked in
iBATIS 2, it was strictly by luck.  It was never a feature though.

You shouldn't need to specify the JDBC type in the example you give though,
because it's not nullable (that query would be invalid with a null value).
You would only get that error if you actually pass a null into the query.

Because Java is strongly typed, iBATIS embraces that, while hopefully
striking a balance of simplicity and avoids duplicate type definition where
possible.

Clinton

On Fri, Jan 15, 2010 at 12:17 PM, Jun Yang <jyang...@gmail.com> wrote:

> Hi all,
>
> I have started to use iBATIS 3 and am loving it!  Thanks!
>
> I have a question regarding how to do automatic type conversion.
>  In iBATIS 2,  if I have "select * from bug where id = #id:NUMERIC#", if the
> value of id is a string, it's converted to an int automatically.
>
> In iBATIS 3, I have yet to find the equivalent.  I tried "select * from bug
> where id = #{id,javaType=int,jdbcType=NUMERIC}" and got a class cast
> exception.  So the right type is expected.
>
> I also tried "select * from bug where id = numeric(#{id})" and got "Cause:
> org.apache.ibatis.type.TypeException: JDBC requires that the JdbcType must
> be specified for all nullable parameters."
>
> How can I easily configure to have that string value converted
> automatically to an integer?
>
> Thanks a lot!
>
> Jun
>

Reply via email to