Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection doe
上下观古今,起伏千万途。这篇文章主要讲述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】
推荐阅读
- SAS,R与Python的区别详细对比
- Android---mediaplayer 创建和调用顺序
- 基于APICloud的民宿预订APP
- Android 开发学习进程0.15adb
- DjangoRestFramework整合social-auth-app-django实现第三方登录
- Android开发中的SQLite事务处理
- 介绍一下 WebApplicationContext ?
- android日记
- ApplicationContext 通常的实现是什么?