您的位置:首页 > 移动开发

Type interface mapper.UserMapper is not known to the MapperRegistry.

2017-08-14 13:35 1276 查看
org.apache.ibatis.exceptions.PersistenceException:

### Error building SqlSession.

### The error may exist in mybatis/mapper/UserMapper.xml

org.apache.ibatis.binding.BindingException: Type interface mapper.UserMapper is not known to the MapperRegistry.

在学习mybatis的过程中遇到了以上相关的问题,最后解决办法是:





UserMapper.xml中的namespace 要和全局配置文件中注册的路径一样。

————————————————————————————————————————————————————————————————

下面附上网上查找的编写mapper接口的四个开发规范:

在mapper.xml中,使namespace等于mapper接口的地址(完全限定名)
mapper.java接口中的方法名和mapper.xml中statement的id一致
mapper.java接口中方法的输入参数类型和mapper.xml中statement的parameterType指定的类型一致
mapper.java接口中方法返回值类型和mapper.xml中statement的resultType指定的类型一致
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐