MyBatis的通俗理解:SqlSession.getMapper()源码分析
作者:互联网
参考:MyBatis的通俗理解:SqlSession.getMapper()源码分析
笔记:
- SqlSession中可以通过getMapper()拿到代理对象,SqlSession.getMapper 运用了 JDK动态代理,产生了目标Mapper接口的代理对象。
public void getUserByLimit(){ SqlSession sqlSession = MybatisUtils.getSqlSession(); UserMapper mapper = sqlSession.getMapper(UserMapper.class); HashMap<String, Integer> map = new HashMap<String, Integer>(); map.put("startIndex",0); map.put("pageSize",2); List<User> userList = mapper.getUserByLimit(map); for (User user : userList) { System.out.println(user); } sqlSession.close();
标签:map,getMapper,HashMap,sqlSession,SqlSession,源码 来源: https://www.cnblogs.com/sedkyzx/p/15521259.html