HTTP Status 500 - 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 ‘id’ in ‘class com.cd.bean.Message’

最近在做的一个项目,在通过id来执行更新时出现上述错误,调试之后发现,执行更新时传入的对象里面并没有名称为id属性,于是将他改成了对象里面自定义的MESSAGE_ID,这杨就可以了。

指的注意的是,此处的paramterType=”message”,message是实体类的别名。mybatis可以自行匹配找到实体类中的MESSAGE_ID属性。
如果此处换成paramterType=”Integer” 或其他类型,
MESSAGE_ID = #{MESSAGE_ID}中可以写成MESSAGE_ID = #{id}