It may be that your mapper.xml file is using the incorrect namespace (perhaps because of a copy paste error).
For instance, let's say you have a Java interface called MyEntityMapper.java
that should be linked to a mybatis mapper xml config called MyEntityMapper.xml
:
MyEntityMapper.java
package my.mappers;
public interface MyEntityMapper {
MyEntity getById(@Param("id") String id);
}
MyEntityMapper.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="non.existent.package.NonExistentMapper">
<resultMap id="MyEntityResultmap" type="MyEntity">
<!-- some result map stuff here -->
</resultMap>
<select id="getByUuid" resultMap="MyEntityResultMap">
<!-- some sql code here -->
</select>
</mapper>
Notice that the namespace
attribute on the <mapper>
element in MyEntityMapper.xml
is pointing to some non-existent mapper non.existent.package.NonExistentMapper
, when really it should be pointing to my.mappers.MyEntityMapper
.