Illegalargumentexception:mapped Statements collection does not contain value for mapper solution

Source: Internet
Author: User
the problem is described as follows: using MyBatis to develop with the following problems,

2012-8-7 17:23:48 Org.apache.catalina.core.StandardWrapperValve Invoke
Serious: 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 $Proxy 7.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)


Problem Solving:

Looking for a long time, found the cause of the problem is chartmapper.getspammsgcount this write wrong ... Because is many people development, this Mapper not I write, is another colleague writes, this Mapper incredibly is chartsMapper, this question debugging for a long time, I le a go ah ... Write this blog to encourage yourself, not to make this low-level mistake again ...

To add, the paging query statement in SQL Server is as follows: (What's row_number?). )

SELECT * FROM (
			select Smscontent, sum (motimes) as Motimes,
	     	        row_number () over (order by SUM (Motimes) DESC) as Rown Umber from 
			stat_failuserinput 
			WHERE calcdate >= ' 2012-07-30 ' and calcdate <= ' 2012-08-06 ' and smscontent LI KE '%${smscontent}% '
			GROUP by smscontent
	) U WHERE rownumber > 0 and RowNumber <= 10


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.