Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection doe

Posted lxhk

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection doe相关的知识,希望对你有一定的参考价值。

1.异常信息

Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.lxh.mapper3.clazzMapper.selCla
### The error may exist in com/lxh/mapper3/studentMapper.xml
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: select * from student
### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.lxh.mapper3.clazzMapper.selCla
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:111)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:102)
at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:119)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
at com.sun.proxy.$Proxy0.selStu(Unknown Source)
at com.lxh.mybatis_resultmap_n_1.TestResultMap.main(TestResultMap.java:15)
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.lxh.mapper3.clazzMapper.selCla
at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:797)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:631)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:624)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getNestedQueryMappingValue(DefaultResultSetHandler.java:593)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getPropertyMappingValue(DefaultResultSetHandler.java:380)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.applyPropertyMappings(DefaultResultSetHandler.java:364)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getRowValue(DefaultResultSetHandler.java:338)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValuesForSimpleResultMap(DefaultResultSetHandler.java:291)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValues(DefaultResultSetHandler.java:266)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:236)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:150)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:60)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:73)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:60)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:267)

问题:一开始找半天以为是StudentMapper.xml配置的问题,后面单个测试后才发现是思路错了,以为没有直接调用到不需要创建clazzMapper接口类,但其实隐形是有调用到的

解决:创建clazzMapper接口,定义selCla()

技术图片

 

 

以上是关于Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection doe的主要内容,如果未能解决你的问题,请参考以下文章

[经验栈]Typecho升级(upgrade)失败Database Query Error

搭建Mybatis 出现 Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statement

Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection doe

### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException

Error querying database. Cause: org.apache.ibatis.builder.IncompleteElementException: Could not find

Error querying database. Cause: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][