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}
本文介绍了一种在使用MyBatis框架时遇到的更新操作异常问题及其解决方案。当尝试通过ID更新数据时,出现HTTP状态500错误提示,原因是对象没有名为'id'的getter方法。通过更改为实体类中定义的属性MESSAGE_ID解决问题。
834

被折叠的 条评论
为什么被折叠?



