mybatis查询传递Integer类型参数报错

使用mybatis查询数据库,在传递Integer类型参数时,遇到下面的错误:

Servlet.service() for servlet [spring] in context with path /] threw exception [Request processing failed;
nested exception is org.mybatis.spring.MyBatisSystemException:
nested exception is org.apache.ibatis.reflection.ReflectionException:
There is no getter for property named ‘abc’ in ‘class java.lang.Integer’]

解决方法有两种:

一是将参数名称 “abc” 替换为”_parameter”。

二是在接口中定义方法时添加标注@Param(“abc”)

发表评论

电子邮件地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.