错误情况
Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Could not set property 'paperId' of 'class com.xiaobao.pojo.Paper' with value '1' Cause: org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'paperId' in 'class com.xiaobao.pojo.Paper'
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Could not set property 'paperId' of 'class com.xiaobao.pojo.Paper' with value '1' Cause: org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'paperId' in 'class com.xiaobao.pojo.Paper' org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) javax.servlet.http.HttpServlet.service(HttpServlet.java:634) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:741) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
原因 实体类 与 mapper.xml 文件的get,set方法不对应 顺便检查一下jsp文件 以防写错字母




本文详细解析了一个关于MyBatis框架中实体类属性映射的问题,具体表现为在尝试设置Paper实体类的paperId属性时出现异常,原因是实体类中不存在对应的setter方法。文章进一步探讨了此问题的根源在于实体类与mapper.xml文件中的get和set方法不对应,并建议同时检查jsp文件以避免拼写错误。
3917

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



