May 16, 2021 MyBatis
A: Cannot be overloaded, the method name corresponds to the mapper.xml file of an id, this corresponds to the method name, the system will be based on namespace s id to find the corresponding method corresponding.
The Dao interface is the Mapper interface. T he full name of the interface is the value of namespace in the mapping file, the method name of the interface is the id value of statement in the mapper in the mapping file, and the parameter within the interface method is the parameter passed to sql. T he Mapper interface has no implementation class, and when the interface method is called, the interface's full-limit name plus method name stitching string is the key value, which uniquely locates a MapperStatement. In Mybatis, each 、、、 is parsed as a MapperState object.
For example: com.mybatis3.mappers.StudentDao.findStudentById, the only place to find namespace is com.mybatis3.mappers.studentDao.
Methods in the Mapper interface cannot be overloaded because they are saved and looked for using the full limit name and method name. The Mapper interface works as a JDK dynamic proxy, and the Mybatis runtime uses the JDK dynamic proxy to generate proxy object proxy for the Mapper interface, which intercepts the interface method, instead executing the sql represented by MapperStatement and returning the sql execution results.