org.apache.ibatis.binding.BindingException: Type interface dao.EmployeeMapper2 is not known to the M

org.apache.ibatis.binding.BindingException: Type interface dao.EmployeeMapper2 is not known to the M
//测试通过resultMap进行高级映射返回对象
@Test
public void test() throws IOException {
    SqlSessionFactory sqlSessionFactory = getSqlSessionFactory();
    SqlSession sqlSession = sqlSessionFactory.openSession();
    System.out.println(sqlSessionFactory);
    try {
        EmployeeMapper2 mapper2 = sqlSession.getMapper(EmployeeMapper2.class);
        Employee byId = mapper2.getById(2);
        System.out.println(byId);
    }catch (Exception e)
    {
        e.printStackTrace();
    }finally {
        sqlSession.close();
    }
}

爆出下面的错误

其中配置文件EmployeeMapper2.xml的文件如下:

select * from tb1_employee where id = #{id}

在该映射文件中, 中的namespace的值应为对应的接口的类路径dao.EmployeeMapper2

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5692121.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存