首页 > 精品文库 > mybatis报错Mapped Statements collection does not contain value for com.inter.IOper

mybatis报错Mapped Statements collection does not contain value for com.inter.IOper

2015-04-09 浏览(52)

 

[摘要:正在顺序挪用IOperation接心中的getAllItems方式时,涌现了以下毛病: Exception in thread main org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.inter.IOperation.getAllItems at org.apache.ib]

在程序调用IOperation接口中的getAllItems方法时,出现了以下错误:

Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.inter.IOperation.getAllItems
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 com.sun.proxy.$Proxy0.getAllItems(Unknown Source)
at analysis.ReviewsMining.processProcessedReviews(ReviewsMining.java:88)
at analysis.ReviewsMining.main(ReviewsMining.java:152)
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.inter.IOperation.getAllItems
at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:768)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:603)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:596)
at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:176)

出现这种错误有几种原因:

1、命名空间没写对,如果使用mapper,则<mapper namespace="com.inter.IOperation">(IOperation是个接口,里面含有方法getAllItems)

2、getAllItems方法在item.xml中没有,然后执行getAllItems方法会报错

3、getAllItems方法的返回值是List<Item>,而select元素没有正确配置ResultMap,或者只配置了ResultType

4、在与数据库连接相关的配置文件Configuration.xml中,在<mappers>中漏了<mapper resource="com/items/Item.xml"/>(这也是我这次错误的原因)

mybatis报错Mapped Statements collection does not contain value for com.inter.IOper的更多相关文章

  1. Mybatis报错——Mapped Statements collection already contains value for

    解决办法: 看看你的mybatis-config.xml <mappers>     <mapper resource="mapper/SeckillDao.xml&quo ...

  2. 报错Mapped Statements collection does not contain value for com.atguigu.mybatis.dao.EmployeeMapperPlus

    报错Mapped Statements collection does not contain value for com.atguigu.mybatis.dao.EmployeeMapperPlus ...

  3. Spring+Mybatis整合报错Mapped Statements collection does not contain value原因之一

    报错如下: ### Error updating database. Cause: java.lang.IllegalArgumentException: Mapped Statements coll ...

  4. Springboot+Mybatisplus替换mybatis整合报错Mapped Statements collection does not contain value

    问题一: mybatisPlus完全兼容mybatis,一般来说直接替换掉就可以了,如果mybatis的数据源不能取消创建的话,就注掉mybatisplus的数据源 //@Configurationp ...

  5. mybatis启动报错Mapped Statements collection already contains value for com.autoyol.mapper.trans.TransDispatchingMapper解决

    1.检查sqlsession配置,在applicationContext文件中.检查mybatis配置文件. 2.检查TransDispatchingMapper.java 是接口类,无注解. 3.T ...

  6. mybatis 报错Result Maps collection does not contain value for java.lang.Integer

    重点:报错的方法和xml文件不一定是错误的位置,如果有多个xml文件,必须检查所有的文件 搜索  resultMap="java.lang.Integer" 找到对应的文件,改为  ...

  7. 解决mybatis报错Result Maps collection does not contain value for java.lang.Integer

    解决办法:1.检查mybatis的xml配置 2.在某处肯定有配错了的,如"resultMap" -->"resultType" [html] view ...

  8. MyBatis中出现Mapped Statements collection does not contain value

    引用csdn上一大神的解决方法: 经过排查,解决上述异常的过程如下: 1.确定xml文件中<mapper namespace=""/>中的namespace是否路径正确 ...

  9. mybatis mapper.xml 写关联查询 运用 resultmap 结果集中 用 association 关联其他表 并且 用 association 的 select 查询值 报错 java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for mybatis.map

    用mybaits 写一个关联查询 查询商品表关联商品规格表,并查询规格表中的数量.价格等,为了sql重用性,利用 association 节点 查询 结果并赋值报错 商品表的mapper文件为Gooo ...

随机推荐

  1. 从C++研发到前端工程师

    前言 伴随着今天收到了网易的前端offer,我的转行面试告一段落.能拿到网易的offer很意外,也弥补了去年网易校招被刷的遗憾.虽然从c++转行到前端不是一件很困难的事,但是也说不上轻松,反正我用了整 ...

  2. sockaddr与sockaddr_in结构体简介

    struct sockaddr { unsigned  short  sa_family;     /* address family, AF_xxx */char  sa_data[14];     ...

  3. 简易版viewport

    首先这里涉及到虚拟像素和物理像素,不管是移动设备还是pc都存在这个概念1.在显示器精度还不是很高的年代,一个物理像素就等于一个虚拟像素,1000px的网页就占据了1000的物理像素(如果你玩过小霸王, ...

  4. kill 根据PID终止进程

    根据PID终止进程 kill [option] PID-list kill 通过向一个或多个进程发送信号来终止进程.除超级用户外,只有进程的所有者才可以对进程执行kill 参数 PID-list为ki ...

  5. 1104关于优化mysql服务器几个参数和思路

    转自http://www.cnblogs.com/AloneSword/p/3207697.html 按照从大到小,从主要到次要的形式,分析 mysql 性能优化点,达到最终优化的效果. 利用 min ...

  6. 'hibernate.dialect' must be set when no Connection avalable’

    一个错误'hibernate.dialect' must be set when no Connection avalable ‘ 网上也有不少人遇到这种问题,看上去好像是跟Hibernate的方言有 ...

  7. Ajax 是什么?Ajax 的交互模型?同步和异步的区别?如何解决跨域问题?以及 HTTP状态码

    一.Ajax 是什么: 1. 通过异步模式,提升了用户体验 2. 优化了浏览器和服务器之间的传输,减少不必要的数据往返,减少了带宽占用 3. Ajax 在客户端运行,承担了一部分本来由服务器承担的工作 ...

  8. 开发错误记录8:Unable to instantiate application com

    开发错误记录8:Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication 这是因为在And ...

  9. [转]Filter实现处理中文乱码,转义html标签,过滤敏感词

    原文地址:http://www.cnblogs.com/xdp-gacl/p/3952405.html 在filter中可以得到代表用户请求和响应的request.response对象,因此在编程中可 ...

  10. IntelliJ_13_配置tomcat

    一.下载tomcat7并解压 http://tomcat.apache.org/download-70.cgi http://apache.fayea.com/tomcat/tomcat-7/v7.0 ...