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