MyBatis Reverse engineering (MAVEN)

Source: Internet
Author: User
Tags generator


There are some project paths for reverse engineering

1.maven Add Plugin
<!--MyBatis Reverse engineering maven Tools--<plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3
                            .2</version> <dependencies> <dependency> <groupId>mysql</groupId> <artifactid>mysql-connector-java</artif Actid> <version>${mysql.version}</version> </depende ncy> </dependencies> <configuration> <! --Configuration file path--<configurationfile>${basedir}/src/main/resources/generatorconfig.xml</co Nfigurationfile> <overwrite>true</overwrite> </configuratio N> &LT;/PLUgin> 

2. Add a Jar Package
<!--  MyBatis Reverse engineering jar--
	<dependency>
            <groupid>org.mybatis.generator</groupid >
            <artifactId>mybatis-generator-core</artifactId>
            <version>1.3.2</version>
        </dependency>

3. Add a configuration file under the Resources directory
<?xml version= "1.0" encoding= "UTF-8"?> <! DOCTYPE generatorconfiguration Public "-//mybatis.org//dtd mybatis Generator Configuration 1.0//en" "Http://mybatis.or G/dtd/mybatis-generator-config_1_0.dtd "> <generatorConfiguration> <context id=" test "targetruntime=" MyBatis3 "> <!--some tools--<plugin type=" Org.mybatis.generator.plugins.EqualsHashCodePlugin "></ plugin> <plugin type= "Org.mybatis.generator.plugins.SerializablePlugin" ></plugin> <plugin type= "
			Org.mybatis.generator.plugins.ToStringPlugin "></plugin> <commentGenerator> <!--insert a date field-- <property name= "Suppressdate" value= "true"/> <!--notes--<property name= "Suppressallcomments" value= "False"/> </commentGenerator> <!--database link parameters--<jdbcconnection driverclass= "Com.mysql.jdbc.Driver "Connectionurl=" Jdbc:mysql://localhost:3306/meedesk "userid=" root "password=" moshaoming "> </jdbcConneCtion> <javaTypeResolver> <!--This property was used to specify whether MyBatis Generator should for Ce the use of java.math.BigDecimal for DECIMAL and NUMERIC fields,--<property name= "forcebigdecimals" value= "f Alse "/> </javaTypeResolver> <!--generate the package name and location of the model--<javamodelgenerator targetpackage=" Com.pts.meedes K.model "targetproject=" Src/main/java "> <property name=" enablesubpackages "value=" true "/> <property Name= "Trimstrings" value= "true"/> </javaModelGenerator> <!--generate the package name and location of the map file---<sqlmapgenerator TA Rgetpackage= "Com.pts.meedesk.mappers" targetproject= "src/main/resources" > <property name= "enablesubpackages
			"Value=" true "/> </sqlMapGenerator> <!--generate DAO's package name and location--<javaclientgenerator type=" Xmlmapper " Targetpackage= "Com.pts.meedesk.dao" targetproject= "Src/main/java" > <property name= "enablesubpackages" value= "True"/> </javaclientgenerator> <!--What tables to generate-<table tablename= "user" domainobjectname= "user" enablecountbyexample= "false" Enableupdatebyexample= "false" enabledeletebyexample= "false" enableselectbyexample= "false" selectbyexamplequeryid= "False" ></table> </context> </generatorConfiguration>

4.Run as->maven bulid->mybatis-generator:generate perform->f5 refresh



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.