Upon upgrading mybatis version (3.2.8 --> 3.4.1) and mybatis.spring version (1.2.2 --> 1.3.0), Case of generics is not working

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Upon upgrading mybatis version (3.2.8 --> 3.4.1) and mybatis.spring version (1.2.2 --> 1.3.0), Case of generics is not working

bharathwaj nithin

class Parent : 

     class Parent  {

       class Child<SomeClass> chd;

     };


class Child : 

     Class Child<T> {

        T key;

    };


class SomeClass : 

      class  SomeClass {
      
            Integer Id;
      }; 


Mybatis XML : 


      <resultMap type="Parent" id="parent">   
          <result property="chd.key.id"  column="id" />  
     </resultMap>


ERROR : 


    Caused by: org.apache.ibatis.reflection.ReflectionException: Could not set property 'key' of 'class Child' with value 'java.lang.Object@5c22ecbb' Cause: java.lang.ClassCastException: java.lang.Object cannot be cast to 'SomeClass'



Can you please help me with this.


Thanks
Nithin 

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Upon upgrading mybatis version (3.2.8 --> 3.4.1) and mybatis.spring version (1.2.2 --> 1.3.0), Case of generics is not working

bharathwaj nithin
org.apache.ibatis.reflection.Reflector class changes causing issue.

--older 

    private void addGetMethod(String name, Method method) {
    if (isValidPropertyName(name)) {
      getMethods.put(name, new MethodInvoker(method));
      getTypes.put(name, method.getReturnType());
    }
  }
  
  ---newer 
  
    private void addGetMethod(String name, Method method) {
    if (isValidPropertyName(name)) {
      getMethods.put(name, new MethodInvoker(method));
      Type returnType = TypeParameterResolver.resolveReturnType(method, type);
      getTypes.put(name, typeToClass(returnType));
    }
  }

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Upon upgrading mybatis version (3.2.8 --> 3.4.1) and mybatis.spring version (1.2.2 --> 1.3.0), Case of generics is not working

bharathwaj nithin
In reply to this post by bharathwaj nithin
commit causing issue  : https://github.com/mybatis/mybatis-3/commit/b1e1ae0619c9252c011b575beee5d3d2bb840325

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Upon upgrading mybatis version (3.2.8 --> 3.4.1) and mybatis.spring version (1.2.2 --> 1.3.0), Case of generics is not working

Iwao AVE!
Hi,

Could you open a new ticket on the tracker with a test case?

Thank you!
Iwao

On Tuesday, 20 September 2016, bharathwaj nithin <[hidden email]> wrote:

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;mybatis-user%2Bunsubscribe@googlegroups.com&#39;);" target="_blank">mybatis-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.