Quantcast

When I user @Many , I get a Exceptiong which context is caused by: org.apache.ibatis.reflection.ReflectionException: Error instantiating long with invalid types () or values (). Cause: java.lang.NoSuchMethodException: long.<init>()

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

When I user @Many , I get a Exceptiong which context is caused by: org.apache.ibatis.reflection.ReflectionException: Error instantiating long with invalid types () or values (). Cause: java.lang.NoSuchMethodException: long.<init>()

lbfreezehome
Here is my code :
@Select({"SELECT ", selectField, " FROM ", table,
"WHERE id = #{userId}"
})
@Results({
@Result(property = "writings",
javaType = List.class,
column = "{userId=id}",
many = @Many(select = "me.freezehome.blog.dao.WritingDAO.getEssayByUserId" ) ),
@Result(property = "userStatusEnum", column = "user_status")
})
List<User> getUserAndHisWritings(@Param("userId") long userId);


the getEssayByUserId function is :


@Select({"SELECT ", selectField, " FROM ", table, " WHERE uid=#{userId} ORDER BY create_time DESC"})
@Results({
@Result(column = "status", property = "writingStatusEnum"),
@Result(column = "type", property = "writingEnum"),
})
List<Writing> getEssayByUserId(@Param("userId") long userId);


--
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
|  
Report Content as Inappropriate

Re: When I user @Many , I get a Exceptiong which context is caused by: org.apache.ibatis.reflection.ReflectionException: Error instantiating long with invalid types () or values (). Cause: java.lang.NoSuchMethodException: long.<init>()

Kazuki Shimizu
Probably, this is same with https://github.com/mybatis/mybatis-3/pull/834.


On Friday, December 30, 2016 at 1:17:51 AM UTC+9, [hidden email] wrote:
Here is my code :
@Select({"SELECT ", selectField, " FROM ", table,
"WHERE id = #{userId}"
})
@Results({
@Result(property = "writings",
javaType = List.class,
column = "{userId=id}",
many = @Many(select = "me.freezehome.blog.dao.WritingDAO.getEssayByUserId" ) ),
@Result(property = "userStatusEnum", column = "user_status")
})
List<User> getUserAndHisWritings(@Param("userId") long userId);


the getEssayByUserId function is :


@Select({"SELECT ", selectField, " FROM ", table, " WHERE uid=#{userId} ORDER BY create_time DESC"})
@Results({
@Result(column = "status", property = "writingStatusEnum"),
@Result(column = "type", property = "writingEnum"),
})
List<Writing> getEssayByUserId(@Param("userId") long userId);


--
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.
Loading...