MyBatis Basics-Getting Started program 3

Source: Internet
Author: User
Tags sql injection

Environment and other related references first article Modify Member

configuring modifications in the mapping file statement

Program Writing

The data before executing the procedure is as follows

Post-implementation data are as follows
Query individual member information

configuring queries in a mapping file individual member statement

Program Writing

Query results are as follows
Fuzzy Query multiple member information

Configure a fuzzy query in the mapping file to return multiple members statement

Program Writing

Query results are as follows

#{} represents an ID in a placeholder #{id,jdbctype=varchar} that accepts input parameters, the parameter
name is ID, and if the input parameter is a simple type, then the parameter name in #{} can be arbitrary, can be value or other name
#{} Receives the value of the Pojo object, reads the properties in the object by OGNL, and gets the property value of the object by using the attribute. Property. Attribute
${} is a concatenation of our SQL strings, and the accepted parameters are not decorated in SQL
using ${} Stitching SQL may cause SQL injection
${value} to accept input parameters, and if the input parameter is a simple type, only value
${} can receive Pojo object values in ${}, and the properties in the object are read by OGNL. Gets the property value of the object through the property. property.

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: 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.