Mybatis源码架构
一、JDBC实现查询分析 如果不使用mybatis,使用原生的API来进行JDBC查询时的实现如下: public static List<Map<String,Object>> jdbcQuery(){ Connection connection = null; ResultSet rs = null; PreparedStatement stmt = null; List<Map<String,Object>> resultList = new ArrayList<Map<String,Object>>(); try { //1、加载JDBC驱动 Class.forName("com.mysql.jdbc.Driver").newInstance(); String url = "jdbc:mysql://127.0.0.1:3306/mysql?characterEncoding=UTF-8"; //2、获取数据库连接 connection = DriverManager.getConnection(url,"root","123456"); String sql = "select * from user where id = ? "; //3、创建Statement对象(每一个Statement为一次数据库执行请求) stmt = connection