Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the mybatis generator code generator

Shulou Source: shulou.com Published: 2022-06-03 10:04:03 09月28日 Update

How to use the mybatis generator code generator? for this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.

Introduction to MyBatis Generator

MyBatis Generator (MBG) is the code generator for MyBatis MyBatis and iBATIS. It will generate code for all versions of MyBatis and iBATIS versions after version 2.2.0. It will introspect the database tables (or many tables) and generate artifacts that can be used to access the tables. This reduces the initial hassle of setting up objects and configuration files to interact with database tables. MBG seeks to have a significant impact on most database operations of simple CRUD (create, retrieve, update, delete). You still need to manually write SQL and object code for join queries or stored procedures.

MyBatis Generator download

1. Source code address: https://github.com/mybatis/generator/releases

two。 Official document: http://www.mybatis.org/generator/index.html

Let's take a look at the use of the mybatis generator code generator. The starting structure diagram is as follows:

Introduction of maven files

4.0.0 com.ding mybatis_generator 1.0-SNAPSHOT org.mybatis.generator mybatis-generator-core 1.3.7 org.mybatis mybatis 3.5.7 compile org.mybatis.generator mybatis-generator-maven-plugin 1. 3.2 src/main/resources/generatorConfig.xml

Database

| | Create Table |-- | | CREATE TABLE `student` (| | `id` int (11) NOT NULL AUTO_INCREMENT, | | `NAME` varchar (20) DEFAULT NULL | | `age` int (11) DEFAULT NULL, | | PRIMARY KEY (`id`) | |) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=u |

Write generatorConfig.xml

Generate

The generated structure diagram

The world will not stop because you are tired.

The answer to the question about how to use the mybatis generator code generator is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

Tags: Generation code generator data database version question object file more structure structure diagram help solution easy important easy world content address Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Apple OPPO Reno MariaDB vpn