首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网络技术 > 网络基础 >

IllegalArgumentException: Mapped Statements collection does not contain value fo

2012-09-10 
IllegalArgumentException: Mapped Statements collection does not contain value for Mapper解决办法  

IllegalArgumentException: Mapped Statements collection does not contain value for Mapper解决办法
  问题描述如下:用MyBatis开发时遇到如下问题,

2012-8-7 17:23:48 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet springServlet threw exception
java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for ChartMapper.getSpamMsgCount
at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:594)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:436)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:428)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:77)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:72)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:38)
at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:338)
at $Proxy7.selectOne(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:154)
at com.iflytek.ecss.smss.managesystem.dao.MyBatisDao.get(MyBatisDao.java:33)
at com.iflytek.ecss.smss.managesystem.service.ChartsService.getSpamMsgCount(ChartsService.java:62)
at com.iflytek.ecss.smss.managesystem.controller.ChartController.getSpamMsgData(ChartController.java:529)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


问题解决:

  找了半天,发现问题的原因是ChartMapper.getSpamMsgCount这个写错了!!!由于是多人开发,这个Mapper不是我写的,是另一个同事写的,这个Mapper居然是ChartsMapper,这个问题调试了半天,我勒个去呀。。。。。写此博文以勉励自己,不能再犯此低级错误了!!!

  补充一点,关于sql server中的分页查询语句如下:(其中有什么ROW_NUMBER之类的。。)

SELECT * FROM (SELECT SMSCONTENT, SUM(MOTIMES) AS MOTIMES,             ROW_NUMBER() OVER (ORDER BY SUM(MOTIMES) DESC) AS ROWNUMBER FROM Stat_FailUserInput WHERE CALCDATE >= '2012-07-30' AND CALCDATE <= '2012-08-06' AND SMSCONTENT LIKE '%${smsContent}%'GROUP BY SMSCONTENT) U WHERE ROWNUMBER > 0 AND ROWNUMBER <= 10


热点排行