ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geek Cracovian <geek.cracov...@gmail.com>
Subject Extended support for primitive type mapping
Date Sun, 25 Apr 2010 20:56:24 GMT
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