mybatis自动生成代码配置文件

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <!DOCTYPE generatorConfiguration
 3   PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
 4   "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
 5 
 6 <generatorConfiguration>
 7     <!-- classPathEntry:数据库的JDBC驱动 -->
 8     <classPathEntry location="WebContent/WEB-INF/lib/postgresql-8.3-607.jdbc4.jar" />
 9     <context id="DB2Tables" targetRuntime="MyBatis3">
10         <!-- 去除自动生成的注释 -->
11         <!--
12             <commentGenerator> <property name="suppressDate" value="true" />
13             </commentGenerator>
14         -->
15         <plugin type="org.mybatis.generator.plugins.RenameExampleClassPlugin">
16             <property name="searchString" value="Example$" />
17             <property name="replaceString" value="QueryBean" />
18         </plugin>
19         <jdbcConnection driverClass="org.postgresql.Driver"
20             connectionURL="jdbc:postgresql://xxxxxx/xxxxx" userId="postgres"
21             password="xxxxx">
22         </jdbcConnection>
23 
24         <javaTypeResolver>
25             <property name="forceBigDecimals" value="false" />
26         </javaTypeResolver>
27         <!-- targetProject:自动生成代码的位置 -->
28         <javaModelGenerator targetPackage="entity"
29             targetProject="./src/main">
30             <property name="enableSubPackages" value="false" />
31             <property name="trimStrings" value="true" />
32         </javaModelGenerator>
33 
34         <sqlMapGenerator targetPackage="dao" targetProject="./src/main">
35             <property name="enableSubPackages" value="false" />
36         </sqlMapGenerator>
37 
38         <javaClientGenerator type="XMLMAPPER"
39             targetPackage="dao" targetProject="./src/main">
40             <property name="enableSubPackages" value="false" />
41         </javaClientGenerator>
42         <!-- tableName:用于自动生成代码的数据库表;domainObjectName:对应于数据库表的javaBean类名 -->
43         <table tableName="xxxx" schema="xxxx"
44             domainObjectName="xxxx" />
45     </context>
46 </generatorConfiguration>

然后在Run Configuration里面找到Shell Runner

在Argument里面输入 -configfile ./xxx/config.xml -overwrite

posted @ 2013-04-30 17:49  xiaoskery  阅读(456)  评论(0编辑  收藏  举报