mybatis 入门练习项目报错:
### Error updating database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for c***********ent
### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for c***********ent
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)
at ………………
原因在于session执行的映射文件名错误,与映射文件中<mapper namespace="***********">不一样
// Test.java
SqlSession session = factory.openSession();
session.insert("com.lee.dao.IStudentMapper.saveStudent"); // 映射文件路径
<!-- StuMapper.xml -->
<mapper namespace="com.lee.dao.IStudentMapper">
博客记录了MyBatis入门练习项目报错情况,错误信息为'Mapped Statements collection does not contain value for...',经分析,报错原因是session执行的映射文件名与映射文件中<mapper namespace>不一致。

14万+

被折叠的 条评论
为什么被折叠?



