09_mybatis development of DAO Method--mapper Agent Development specification

Source: Internet
Author: User

First, the development of norms

You need to write the Mapper.xml mapping file (this project is usermapper.xml, similar to the previous user.xml).

Writing mapper interfaces requires following some development specifications, so that MyBatis can automatically generate mapper interfaces to implement proxy objects.

1. Namespace equals Mapper interface address in Usermapper

namespace in "Usermapper.xml":

The ID of the statement in the 2.UserMapper interface is the same as that of the method name in Usermapper.xml

"Usermapper.java"

"Usermapper.xml"

The method input parameter type in the 3.usermapper.java interface is the same as the ParameterType specified type in Usermapper.xml. Statement.

"Usermapper.java"

"Usermapper.xml"

The return value type of the method in the 4.usermapper.java interface is consistent with the Resulttype specified by the statement in the Usermapper.xml

"Usermapper.java"

"Usermapper.xml"

"The important role of the above development norms"

The development specification will produce a unified build of the code:

.........

09_mybatis development of DAO Method--mapper Agent Development specification

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.