目录
一、Mybatis-generator
Mybatis-generator可以帮助开发人员快速实现从表到java对象的生成工作,让开发人员解放出来更专注于业务逻辑的开发。
1、在pom.xml中添加插件,并配置对表重复生成时会覆盖
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.7</version>
<configuration>
<overwrite>true</overwrite>
</configuration>
</plugin>
2、在resources目录下新建generatorConfig.xml,从官网http://mybatis.org/generator/configreference/xmlconfig.html中粘贴示例,再根据自身项目修改
<?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>
<classPathEntry location="G:\Projects\JavaProjects\mysql-connector-java-5.1.6.jar" />
<context id="DB2Tables" targetRuntime="MyBatis3">
<plugin type="org.mybatis.generator.plugins.UnmergeableXmlMappersPlugin" />
<commentGenerator>
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
c