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