全部Generator的xml詳細說明見:http://mybatis.org/generator/configreference/xmlconfig.html (英文版)html
引用 http://blog.csdn.net/pk490525/article/details/16819307java
如今針對generatorConfig.xml配置進行解說,至於其內部元素的詳解見英文文檔,貼上xml,裏面都有註釋,你們一看就明白了:sql
- <?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="init.properties"/>
-
-
- <classPathEntry location="${classPath}" />
-
-
- <context id="infoGuardian">
-
- <commentGenerator >
- <property name="suppressAllComments" value="false"/>
- <property name="suppressDate" value="true" />
- </commentGenerator>
-
-
- <jdbcConnection driverClass="${jdbc_driver}"
- connectionURL="${jdbc_url}" userId="${jdbc_user}"
- password="${jdbc_password}" />
-
-
- <javaTypeResolver>
-
- <property name="forceBigDecimals" value="false"/>
- </javaTypeResolver>
-
-
- <javaModelGenerator targetPackage="com.oop.eksp.user.model"
- targetProject="${project}" >
-
- <property name="enableSubPackages" value="false"/>
-
- <property name="trimStrings" value="true"/>
- </javaModelGenerator>
-
-
- <sqlMapGenerator targetPackage="com.oop.eksp.user.data"
- targetProject="${project}" >
-
- <property name="enableSubPackages" value="false" />
- </sqlMapGenerator>
-
-
- <javaClientGenerator targetPackage="com.oop.eksp.user.data"
- targetProject="${project}" type="XMLMAPPER" >
-
- <property name="enableSubPackages" value="false" />
- </javaClientGenerator>
-
-
- <table schema="${jdbc_user}" tableName="s_user"
- domainObjectName="UserEntity" enableCountByExample="false"
- enableDeleteByExample="false" enableSelectByExample="false"
- enableUpdateByExample="false">
- <!-- schema即爲數據庫名 tableName爲對應的數據庫表 domainObjectName是要生成的實體類 enable*ByExample
- 是否生成 example類 -->
-
-
- <ignoreColumn column="FRED" />
-
- <columnOverride column="LONG_VARCHAR_FIELD" jdbcType="VARCHAR" />
- </table>
-
- </context>
- </generatorConfiguration>
附帶上個人init.properties數據庫
- #Mybatis Generator configuration
- project = EKSP
- classPath=E:/workplace/EKSP/WebContent/WEB-INF/lib/ojdbc14.jar
- jdbc_driver = oracle.jdbc.driver.OracleDriver
- jdbc_url=jdbc:oracle:thin:@127.0.0.1:1521:orcl
- jdbc_user=INFOGUARDIAN
- jdbc_password=info_idap132
以上是xml的配置基本狀況,你們若是有什麼疑問或者建議,敬請評論!mybatis