标签:mybatis
<?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="./lib/ojdbc6.jar" />
<context id="DB2Tables" targetRuntime="MyBatis3">
<plugin type="org.mybatis.generator.plugins.EqualsHashCodePlugin" />
<plugin type="org.mybatis.generator.plugins.SerializablePlugin" />
<plugin type="org.mybatis.generator.plugins.CaseInsensitiveLikePlugin" />
<plugin type="org.mybatis.generator.plugins.RenameExampleClassPlugin">
<property name="searchString" value="Example$" />
<property name="replaceString" value="Criteria" />
</plugin>
<plugin type="org.mybatis.generator.plugins.MapperConfigPlugin">
<property name="fileName" value="sqlMapConfig-temp.xml" /><!-- 生成xml文件的目录-->
<property name="targetPackage" value="config.mybatis" /><!--文件夹路径-->
<property name="targetProject" value="../resources/" /><!--sqlMapConfig-temp.xml 的路径-->
</plugin>
<commentGenerator>
<property name="suppressDate" value="true" />
<!-- 去除自动生成的注释 -->
<property name="suppressAllComments" value="false" />
</commentGenerator>
<jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver"<连接数据库>
connectionURL="jdbc:oracle:thin:@127.0.0.1:1521:orcl" userId="orcl"
password="oracle11">
</jdbcConnection>
<javaTypeResolver>
<property name="forceBigDecimals" value="true" />
</javaTypeResolver>
<javaModelGenerator targetPackage="com.mybatisgenerator.model"<!--生成model-->
targetProject="../src/">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
</javaModelGenerator>
<sqlMapGenerator targetPackage="sqlmap.base"<!--生成mapper.xml文件-->
targetProject="../resources/">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<javaClientGenerator type="XMLMAPPER"<!--生成mapper.java文件-->
implementationPackage="com.mybatisgenerator.mapper" targetPackage="com.mybatisgenerator.mapper"
targetProject="../src/">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<table tableName="T_DISCOUNT_COUPON" domainObjectName="DiscountCoupon"<!--表名,文件前缀名-->
enableCountByExample="true" enableDeleteByExample="true"
enableSelectByExample="true" enableUpdateByExample="true" >
<generatedKey column="COUPON_ID" sqlStatement="select DISCOUNT_COUPON_SEQ.NEXTVAL from DUAL" identity="false" /> <!--主键和表序列查询-->
</table>
</context>
</generatorConfiguration>
genarator.xml<!--执行文件-->
<?xml version="1.0" encoding="UTF-8"?>
<project name="Mybatis-Generator" default="default" basedir=".">
<target name="default" depends="genfiles-all" />
<target name="genfiles-all" description="Generate the files">
<taskdef name="mbgenerator" classname="org.mybatis.generator.ant.GeneratorAntTask"
classpath="../web/WEB-INF/classes;./lib/mybatis-generator-core-1.3.1.jar;./lib/mybatis-3.1.0.jar" /><!--jar包的引用-->
<mbgenerator overwrite="true" configfile="config/config.xml" <!--引用config.xml文件-->
verbose="false">
</mbgenerator>
</target>
</project>
demo路径http://download.csdn.net/detail/strutce/8916389
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:mybatis
原文地址:http://blog.csdn.net/strutce/article/details/46968537