Mybatis _ Entry Program, mybatis Entry Program

Source: Internet
Author: User

Mybatis _ Entry Program, mybatis Entry Program
Mybatis entry (1), program environment 1, jar package

 

 

2. Create SqlMapConfig. xml in the classpath directory.

Mybatis configuration file. All settings are as follows:

 

 

In addition, database parameters can be separated by properties files. The properties file is db. properties.

To differentiate directories. Create a new source folder (config) to place the configuration file. The two files are as follows.

 

 

 

SqlMapConfig. xml header

<? Xml version ="1.0"Encoding =UTF-8"?>

<! DOCTYPE configuration

PUBLIC "-// mybatis.org//DTD Config 3.0 // EN"

Http://mybatis.org/dtd/mybatis-3-config.dtd>

 

3. mapper. xml file (User. xml)

Some CURD statements.

 

 

4. Add mapper. xml to SqlMapConfig. xml

For example, mappers label in 2.

5. Logging

Allows you to conveniently view the running status.

 

 

 

(2) test procedures and program structure 1. Entry-level procedures

 

 

2. directory structure

 

 

 

(3) Summary

Create a mybatis environment using the configuration file. Then, you can use SqlSession to operate statement. (SQL statement in xml file)

 

 

Partial select

 

 

Update

 

 

 

Insert

 

 

 

Delete

 

 

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.