MyBatis的常见异常
1.Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
错误:匹配不了
原因:配置文件中的id方法名和dao接口中的方法名不一致
2.executor.ExecutorException: Statement returned more than one row, where no more than one was expected.`
错误:返回了多行
原因: 或许你想要的是一个对象,但是返回值是一个list.
解决方案:修改返回值类型
3.org apache. ibatis. binding. BindingException: Type interface org . aptech. hdax . dao. BlonDao is not known to the MapperRegistry.
错误:绑定错误
原因:mybatis配置中或许没有导入配置文件
解决方案:去看看mybatis配置文件中mapper标签有没有导入映射文件
4.Could not resolve type alias ‘users’. Cause: java.lang.ClassNotFoundException: Cannot find class: users
错误:类路径或者别名写错了