Request processing failed nested exception is org.mybatis.spring

整合ssm时,当对数据库进行操作时报错:Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘teacher_id’ not found. Available parameters are [arg1, arg0, param1, param2]

标题Request processing failed nested exception is org.mybatis.spring_第1张图片

后来发现原来当方法中的参数多个时要在*mapper.java中使用@Param修饰参数,当只有一个参数时,Mapper中可以不使用
eg: public Teacher_Course findById(@Param(“teacher_id”)int teacher_id, @Param(“course_name”)String course_name);

参考:https://blog.csdn.net/sinat_29325027/article/details/51143448?_t_t_t=0.2515934589002933

你可能感兴趣的:(Bug,java,ssm,bug)