Use of the Model,mapper,xml tool to automatically generate MyBatis

Source: Internet
Author: User

First put these three files in a directory, I was placed in the C disk under the Wangbo directory:

The next step is to set up the Config. config file, config:

1 <?XML version= "1.0" encoding= "UTF-8"?>  2 <!DOCTYPE generatorconfiguration3 Public "-//mybatis.org//dtd mybatis Generator Configuration 1.0//en"4 "Http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">  5 <generatorconfiguration>  6 <!--Database-driven -  7 <Classpathentry Location= "Ojdbc14.jar"/>8 <!--Modify Targetruntime= "MyBatis3" -9 <ContextID= "Db2tables"Targetruntime= "MyBatis3">Ten <Commentgenerator>   One < Propertyname= "Suppressdate"value= "true"/>   A <!--whether to remove automatically generated comments true: Yes: false: No -   - < Propertyname= "Suppressallcomments"value= "true"/>   - </Commentgenerator>   the <!--database link URL, user name, password -   - <jdbcconnectionDriverclass= "Oracle.jdbc.driver.OracleDriver"Connectionurl= "JDBC:ORACLE:THIN:@124.237.121.124:1521:ORADB"userId= "album"Password= "SDFWETERTERTGDFGERTRTTT">   - </jdbcconnection>   - <Javatyperesolver>   + < Propertyname= "Forcebigdecimals"value= "false"/>   - </Javatyperesolver>   + <!--Build the package name and location of the model -   A <JavamodelgeneratorTargetpackage= "Test.model"Targetproject= "C:\wangbo\"> at < Propertyname= "Enablesubpackages"value= "true"/>   - < Propertyname= "Trimstrings"value= "true"/>   - </Javamodelgenerator>   - <!--Build the package name and location of the mapping file -   - <SqlmapgeneratorTargetpackage= "Test.mapping"Targetproject= "C:\wangbo\">   - < Propertyname= "Enablesubpackages"value= "false"/>   in </Sqlmapgenerator>   - <!--generate DAO's package name and location type= "Xmlmapper" -   to <Javaclientgeneratortype= "Xmlmapper"Targetpackage= "Test.dao"Targetproject= "C:\wangbo\">   + < Propertyname= "Enablesubpackages"value= "true"/>   - </Javaclientgenerator> the  * <!--which tables to generate -   $ <TableTableName= "Xlw_user_branch"Domainobjectname= "Userbranch"Enablecountbyexample= "false"Enableupdatebyexample= "false"Enabledeletebyexample= "false"Enableselectbyexample= "false"Selectbyexamplequeryid= "false"></Table>Panax Notoginseng </Context>   - </generatorconfiguration>  

Here's where to configure it:

After configuration, open the cmd command line, go to the directory where the configuration file is located, execute the command is good:

Command: Java-jar mybatis-generator-core-1.3.2.jar-configfile config.xml-overwrite

The test package is then generated:

Use of the Model,mapper,xml tool to automatically generate MyBatis

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.