//测试通过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的文件如下:
在该映射文件中, 中的namespace的值应为对应的接口的类路径dao.EmployeeMapper2
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)