Always rely on me is not very like the automatic generation of code tools, because the generated code is not very good, adaptability is bad!
Besides, writing some code yourself is not going to cost much time. But at the request of the classmate, I helped him install the MyBatis Generator.
Pom.xml:
<plugins> <plugin> <groupId>org.mybatis.generator</groupId><artifactId> mybatis-generator-maven-plugin</artifactid><version>1.3.2</version><configuration>< Verbose>true</verbose><overwrite>true</overwrite></configuration></plugin> </plugins><dependencies> <dependency><groupId>org.mybatis.generator</groupId>< Artifactid>mybatis-generator-core</artifactid><version>1.3.2</version></dependency> </dependencies>
Put the Generatorconfig.xml file in/voicelog/src/main/resource/:
<?xml version= "1.0" encoding= "UTF-8" ?><! doctype generatorconfiguration public "-//mybatis.org//dtd mybatis generator configuration 1.0//en " " HTTP://MYBATIS.ORG/DTD/MYBATIS-GENERATOR-CONFIG_1_0.DTD " >< generatorconfiguration ><!-- Set MySQL drive path --><classPathEntry location= "D:\Code\maven3\repo\m2\mysql\mysql-connector-java\5.1.37\ Mysql-connector-java-5.1.37.jar " /><!-- here to specify dao --> < for MYBATIS3 Context id= "Context1" targetruntime= "MyBatis3" > <!-- jdbc connection Information -- > <jdbcconnection driverclass= "Com.mysql.jdbc.Driver" connectionurl= "Jdbc:mysql://localhost:3306/yii" userid= "root" password= "root" /> <!-- generate VO objects --> <javamodelgenerator targetpackage= "Com.baidu.voice.model" targetproject= "Voicelog" /> <!-- Generate example objects for querying --> < Sqlmapgenerator targetpackage= "Com.baidu.voice.model" targetproject= "Voicelog" /> <!-- Generate DAO's class file and configuration file --> <javaclientgenerator targetpackage= "Com.baidu.voice.dao" targetproject= "Voicelog" type= "Xmlmapper" /> <!-- The database tables you want to generate, the Automation tool generates the corresponding Vo objects based on the structure of the table --> <table schema= "" tablename= "admin" > </table> </context ></generatorConfiguration>
MyEclipse Installing the MyBatis Generator plugin:
http://mybatis.googlecode.com/svn/sub-projects/generator/trunk/eclipse/UpdateSite/
After successful installation:
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7F/D0/wKioL1cuu6LzBbdpAADXO29MU-Q132.png "title=" 12.png "alt=" Wkiol1cuu6lzbbdpaadxo29mu-q132.png "/>
You can do it!
This article is from the "dream to think XI" blog, please be sure to keep this source http://qiangmzsx.blog.51cto.com/2052549/1771171
Maven Install MyBatis Generator