Stage 3 1.Mybatis_06. Mybatis use DAO layer to complete the development of the implementation process _7 Dao agent used in the analysis Mybatis

Another case, do not write dao case of implementation class Mybits.
Switching to CRUD engineering project. There is no way to write dao implementation class

into GetMaper inside. Here it is to create a proxy object

to find SqlSession implementation class DefaultSqlSession

DefaultSqlSession getMapper method of

entering the Configuration of getMapper method


getMapper method of MapperRegistry. Which is taking the method of mapperProxyFactory.newInstance


call the above method below.

Classloader first parameter, the second parameter interface implemented, how the third parameter agent. Our focus is on how the third argument mapperProxy agent

into mapperProxy

which is above MapperProxy

achieved InvocationHandler interface. Inside rewrite invoke methods

keep looking mapperMethod.execute




rowCountResult

executeForMany method

executeForMany inside the final call is sqlSession method of selectList


 

Guess you like

Origin www.cnblogs.com/wangjunwei/p/11313580.html