MyBatis (three) - Dynamic Proxy

Dao a defect class NA

1. Each filling method of the first full path cumbersome and only one parameter, a plurality of parameters, must be submitted using Map.

2. After using dynamic proxies, we can create a global variable Dao directly in the business layer, use it a lot easier.

Two dynamic proxy implementation

namespace 1.mapper mapping file must be mapped to the full path of dao

2. All methods must be fully consistent with id

mapper 3.Mybatisconfig file or files to point mapper.xml

4. After obtaining the session, using session.getMapper (class objects bean class) to obtain dao class object

Three CRUD

1. Like the basic CRUD use dao object to call the method, to give a final int object (refer to how many rows changed)

2. Before the query and only for a way to use it

Guess you like

Origin www.cnblogs.com/qqwhsj/p/11028288.html