[Liu Yang Java]_mybatis_ mapping file's Common label summary _ 5th

Source: Internet
Author: User

Summary of commonly used tags in mybatis, simple to give their own summary

Introduction to label usage in the MyBatis mapping file
1.<SELECT>: Tags used to write query statements

    • ID: Represents the unique identity of the current <select> tag
    • ParameterType: Specifies the input type of the query constraint, typically using #{} to set the parameter value in a preprocessing statement in Preparestatement
    • Resulttype: Specifies the output type of the result that the query returns, and if the returned result is an entity class, you must require that the attribute of the entity class be the same as the field name of the table
    • Resultmap: Also an output type, mate <resultMap> label use
    • Flushcache: Whether to empty the cache when the query is set, false by default
    • UseCache: Put query results in cache, default to True
    • Timeout: Sets the maximum response time for a query to return results
    • Fetchsize: The number of result rows returned per batch. Not set by default
    • Statementtype:statement, prepared, or callable, which allows MyBatis to use the STATEMENT, PreparedStatement, or CallableStatement selection. Default value: PREPARED
    • ResultsetType: Sets one of the cursors forward_only, Scroll_sensitive, scroll_insensitive. Do not set

2.<RESULTMAP>: Used to resolve an issue where the attribute and table field names are not the same in an entity class

    • ID: Represents the unique identity of the current <resultMap> tag
    • Result: Defines the correspondence between table fields and entity class properties
    • Property: Records the attributes of an entity class
    • Column: The field name of the record table

3.<mapper>: The root tag of each mapping file, focusing on the namespace attribute in the <mapper> tag

4.<SQL>: A reusable SQL statement that can be referenced by other statements

5.<insert>: Used to write tags for INSERT statements

6.<UPDATE>: Tags used to write update statements

7.<delete>: A label used to write a DELETE statement

8.<cache>: Configuring the given namespace cache

9.<cache-ref>: Referencing a cache configuration from another namespace

The elements used to implement dynamic SQL in 10.MyBatis are mainly

    • <if>
    • <choose> (when,otherwise)
    • <trim>
    • <where>
    • <set>
    • <foreach>

[Liu Yang Java]_mybatis_ mapping file's Common label summary _ 5th

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.