ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jun Yang <jyang...@gmail.com>
Subject auto type conversion in iBATIS 3?
Date Fri, 15 Jan 2010 19:17:21 GMT
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

Mime
View raw message