mybatis异常ambiguous in Mapped Statements collection 解决方法

Error querying database.  Cause: java.lang.IllegalArgumentException: FindById is ambiguous in Mapped Statements collection (try using the full name including the namespace, or rename one of the entries)

### Cause: java.lang.IllegalArgumentException: FindById is ambiguous in Mapped Statements collection (try using the full name including the namespace, or rename one of the entries)

查询数据库时出错。原因: FindById在映射语句集合中不明确(请尝试使用包含命名空间的全名,或重命名其中一个条目)

# # #原因: Java . lang . illegalargumentexception : FindById在映射语句集合中不明确(请尝试使用包含命名空间的全名,或重命名其中一个条目)

意思就是xml文件里面配置的SQL语句的id冲突了.

解决办法:mapper namespace+SQL的id:

    mapper.xml里面的namespace的值.selectOne("mapper.xml里面的namespace的值.FindById",1);

例如:

CategoryMapper.xml中的

测试代码:


不然就会报错

猜你喜欢

转载自blog.csdn.net/qq_40959340/article/details/80070379