首页 > 代码库 > mybatis一个怪异的问题: Invalid bound statement (not found)
mybatis一个怪异的问题: Invalid bound statement (not found)
Invalid bound statement (not found): me.tspace.pm.dao.UserDao.getUser
at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:178)
at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:38)
at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:49)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:42)
at $Proxy22.getUser(Unknown Source)
........................
........................
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for me.tspace.pm.dao.UserDao.getUser
at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:775)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:615)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:608)
at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:176)
... 34 more
三种情况:
1.
<mapper namespace="me.tspace.pm.dao.UserDao">
mapper的namespace写的不对!!!注意系修改。
2.
UserDao的方法在UserDao.xml中没有,然后执行UserDao的方法会报此
3. UserDao的方法返回值是List<User>,而select元素没有正确配置ResultMap,或者只配置ResultType!
4. 如果你确认没有以上问题,请任意修改下对应的xml文件,比如删除一个空行,保存.问题解决...
mybatis一个怪异的问题: Invalid bound statement (not found)