ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: Extended support for primitive type mapping
Date Mon, 26 Apr 2010 01:50:44 GMT
Done.  I've also added type aliases for array versions of all of the built
in types (using the same naming convention for primitives), for example:

"byte[]" ==> Byte[].class

"_byte[]" ==> byte[].class

etc.

Cheers,
Clinton

On Sun, Apr 25, 2010 at 2:56 PM, Geek Cracovian <geek.cracovian@gmail.com>wrote:

> Hi All,
>
> I'd like to suggest a little patch for iBATIS 'trunk' which improves
> handling of primitive types.
> I had a similar problem to these issues:
> http://www.mail-archive.com/user-java@ibatis.apache.org/msg11096.html
> http://www.mail-archive.com/user-java@ibatis.apache.org/msg07181.html
>
> I need to define a type alias for byte array:
> <typeAlias type="[B" alias="bytes" />
>
> Since iBATIS is using ClassLoader#loadClass method for loading classes,
> the primitive class names are not being understood which results in
> ClassNotFoundException. With the following patch iBATIS will use
> Class#loadClass(String,boolean,ClassLoader) method. Using this fix,
> mapping of byte arrays works fine for me.
>
> Best regards,
> Geek Cracovian
>
>
> The patch:
>
> Index: src/main/java/org/apache/ibatis/io/ClassLoaderWrapper.java
> ===================================================================
> --- src/main/java/org/apache/ibatis/io/ClassLoaderWrapper.java
> (revision 937818)
> +++ src/main/java/org/apache/ibatis/io/ClassLoaderWrapper.java  (working
> copy)
> @@ -188,7 +188,7 @@
>
>         try {
>
> -          Class c = cl.loadClass(name);
> +          Class c = Class.forName(name, true, cl);
>
>           if (null != c) return c;
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

Mime
View raw message