Eclipse Mybatis Generator插件地址:http://mybatis.googlecode.com/svn/sub-projects/generator/trunk/eclipse/UpdateSite/
配置文件generatorConfig.xml
<?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="D:/workspace/mysql-connector-java-3.0.14-production-bin.jar" />
<context id="common" targetRuntime="MyBatis3">
<commentGenerator>
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true" />
</commentGenerator>
<!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://127.0.0.1/cyx_user" userId="root"
password="dongji" />
<!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer true,把JDBC DECIMAL 和
NUMERIC 类型解析为java.math.BigDecimal -->
<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!-- model存放目录 -->
<javaModelGenerator targetPackage="com.chuoyixia.model"
targetProject="t" />
<!-- mapper xml存放目录 -->
<sqlMapGenerator targetPackage="com.chuoyixia.mybatis"
targetProject="t" />
<!-- mapper接口存放目录 -->
<javaClientGenerator targetPackage="com.chuoyixia.mapper"
targetProject="t" type="XMLMAPPER" />
<!-- 配置不生成Exmaple文件 -->
<table schema="cyx_user" tableName="channel" domainObjectName="Channel"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false">
<generatedKey column="id" sqlStatement="SELECT LAST_INSERT_ID()" />
<columnOverride column="urlShow" javaType="int"></columnOverride>
</table>
</context>
</generatorConfiguration>