Configuration的newStatementHandler分析
SimpleExecutor的doUpdate方法上文有分析過:
1 public int doUpdate(MappedStatement ms, Object parameter) throws SQLException { 2 Statement stmt = null; 3 try { 4 Configuration configuration = ms.getConfiguration(); 5 StatementHandler handler = configuration.newStatementHandler(this, ms, parameter, RowBounds.DEFAULT, null, null); 6 stmt = prepareStatement(handler, ms.getStatementLog()); 7 return handler.update(stmt); 8 } finally { 9 closeStatement(stmt);10 }11 }
這兩天重看第5行的newStatementHandler方法的時(shí)候,發(fā)現(xiàn)方法上文在這個(gè)方法中分析地太簡略了,這里過一遍一下Configuration的newStatementHandler方法,方法的實(shí)現(xiàn)為:
延伸閱讀
學(xué)習(xí)是年輕人改變自己的最好方式