just like pic show
,I have difine RecordInfo<T> class , and i Return the RecordInfo<RiskInfo> in queryRiskList function.but i use @Result(property = "content.appId", column = "app_id") to map RiskInfo class Feild appId to database column app_id when I run this function,I get this error "org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'appId' in 'class java.lang.Object'", but I define the type of content as RiskInfo in Function return params, why mybatis can not--
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 mybatis-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/054182d4-dc96-4dbc-beeb-4f7a8e2ba020%40googlegroups.com.
Why is your map mapping appId twice, once for appInfo.appId and again for content.appId?To answer your question, this appears to be the classic problem of type erasure with generics:--Guy RouillierOn 3/17/2020 12:47:11 AM, "喻奇" <yich...@gmail.com> wrote:
--
just like pic show
,I have difine RecordInfo<T> class , and i Return the RecordInfo<RiskInfo> in queryRiskList function.but i use @Result(property = "content.appId", column = "app_id") to map RiskInfo class Feild appId to database column app_id when I run this function,I get this error "org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'appId' in 'class java.lang.Object'", but I define the type of content as RiskInfo in Function return params, why mybatis can not
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 mybati...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/054182d4-dc96-4dbc-beeb-4f7a8e2ba020%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/ec371a86-5f03-48b6-8c89-456c62239f55%40googlegroups.com.
as the pic show,content is defined as Java generic, but at the function return param "RecordInfo<RiskInfo>" ,I already define java generic T as "RiskInfo.class", so why "use annotation @Result can not map custom Java generic that already define the class Type in return param"
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/ec371a86-5f03-48b6-8c89-456c62239f55%40googlegroups.com.