美文网首页
Spring + Mybatis 异常

Spring + Mybatis 异常

作者: 拾壹北 | 来源:发表于2017-03-23 12:04 被阅读137次

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

三种情况:

  • 1.<mapper namespace="me.tspace.pm.dao.UserDao">
    mapper的namespace写的不对!注意修改;

  • 2.UserDao的方法在UserDao.xml中没有,然后执行UserDao的方法会报此异常;

    1. UserDao的方法返回值是List<User>,而select元素没有正确配置ResultMap,或者只配置ResultType;
  • 4.如果你确认没有以上问题,请任意修改下对应的xml文件,比如删除一个空行,保存.问题解决...


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 'diffRecordModel' in 'class com.qunar.fresh2017.exam3.model.DiffRecordModel'

Mybatis进行数据库操作是传入一个model给mapper报此错误,解决方法:

  • 1、将 参数名称 "contentSize" 替换为"_parameter"
    结果正常。
  • 2、在接口中定义方法时 增加 @Param 标记

相关文章

网友评论

      本文标题:Spring + Mybatis 异常

      本文链接:https://www.haomeiwen.com/subject/scuznttx.html