2、组装sql。通过分析ibatis源码知道,最终负责执行sql的类是com.ibatis.sqlmap.engine.execution.SqlExecutor,此类没有实现任何接口,这多少有点遗憾,因为接口是相对稳定契约,非大的版本更新,接口一般是不会变的,而类就相对易变一些,所以这里的代码只能保证对当前版本(2.1.7)的ibatis有效。下面是SqlExecutor执行查询的方法:Java代码1./** 2. * Long form of the method to execute a query
3、 3. * 4. * @param request - the request scope 5. * @param conn - the database connection 6. * @param sql - the SQL statement to execute 7. * @param parameters - the parameters for the statement 8. * @param skipResults - the number of results t
4、o skip 9. * @param maxResults - the maximum number of results to return 10. * @param callback - the row handler for the query 11. * 12. * @throws SQLException - if the query fails 13. */ 14. public void executeQuery(RequestScope request, Conne