很多朋友在使用Mybatis通过获取mapper发送SQL语句时总会遇到这样的错误,这是因为mapper映射文件的namespace所引起的,解决方案就是修改mapper的namespace为相应的dao文件即可。
org.apache.ibatis.binding.BindingException: Type interface dao.IStudentDao is not known to the MapperRegistry.
如下所示:
<mapper namespace="dao.IStudentDao">
<!-- id是该sql语句的名字, parameterType是 -->
<insert id="insertStu" parameterType="mybatis.Student">
insert into
student(name,age,score) values(#{name}, #{age}, #{score})
</insert>
</mapper>