<?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>
<properties resource="config/generator.properties" />
<!-- classPathEntry:数据库的JDBC驱动,换成你自己的驱动位置 -->
<classPathEntry location="${mysql.classPath}" />
<context id="Mysql" targetRuntime="MyBatis3" defaultModelType="flat">
<property name="beginningDelimiter" value="`"/>
<property name="endingDelimiter" value="`"/>
<commentGenerator type="com.ajs.util.config.MyCommentGenerator">
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true" />
<!-- 是否生成注释代时间戳-->
<property name="suppressDate" value="false" />
</commentGenerator>
<!-- 数据库链接URL,用户名、密码 -->
<jdbcConnection connectionURL="${jdbc.url}" driverClass="${jdbc.driverClass}"
password="${jdbc.password}" userId="${jdbc.user}" />
<!-- 指定JDBC和Java类型转换 -->
<javaTypeResolver>
<!-- 是否使用bigDecimal,默认为false false可自动转化以下类型(Long, Integer, Short, etc.) -->
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!-- 生成模型的包名和位置 -->
<javaModelGenerator targetPackage="${package.model}" targetProject="${targetProject}">
<!-- 是否在当前路径下新加一层schema,eg:false路径com.oop.eksp.user.model, true:com.oop.eksp.user.model.[schemaName] -->
<property name="constructorBased" value="true" />
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
<!-- <property name="rootClass" value="com.ajs.base.BaseEntity" /> -->
</javaModelGenerator>
<!-- 生成映射文件的包名和位置 -->
<sqlMapGenerator targetPackage="${package.sql.mapper}" targetProject="${targetProject}">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<!-- 生成DAO的包名和位置 -->
<javaClientGenerator targetPackage="${package.dao.mapper}" targetProject="${targetProject}" type="XMLMAPPER">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<!-- 要生成的表 tableName 是数据库中的表名或视图名 domainObjectName 是实体类名 -->
<table tableName="user_t" domainObjectName="User"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false">
<generatedKey column="id" sqlStatement="Mysql" identity="true" />
<!-- 忽略列,不生成bean 字段 -->
<!-- <ignoreColumn column="FRED" /> -->
<!-- 指定列的java数据类型 -->
<!-- <columnOverride column="LONG_VARCHAR_FIELD" jdbcType="VARCHAR" /> -->
</table>
</context>
</generatorConfiguration>
mysql.classPath=D:/workspace/repository/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar
# 数据库配置
jdbc.driverClass=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/maven?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
jdbc.user=root
jdbc.password=123456
#包文件位置
targetProject=ajs-xhw
package.model=com.javen.model
package.sql.mapper=com.javen.mapping
package.dao.mapper=com.javen.dao
# c3p0
jdbc.maxPoolSize=50
jdbc.minPoolSize=10
jdbc.maxStatements=100
jdbc.testConnection=true
# 通用Mapper配置 待续
#mapper.plugin=tk.mybatis.mapper.generator.MapperPlugin
#mapper.Mapper=com.ifish.common.base.BaseMapper
参考地址:
http://mbg.cndocs.tk/configreference/xmlconfig.html (官网)
http://blog.csdn.net/pk490525/article/details/16819307
http://www.cnblogs.com/AloneSword/p/4883472.html
http://blog.csdn.net/isea533/article/details/42102297
http://www.cnblogs.com/renboqie/p/5637026.html
http://www.cnblogs.com/yjmyzz/p/mybatis-generator-tutorial.html