所有Generator的xml详细说明见:http://mybatis.org/generator/configreference/xmlconfig.html (英文版)

引用 http://blog.csdn.net/pk490525/article/details/16819307

现在针对generatorConfig.xml配置进行解说,至于其内部元素的详解见英文文档,贴上xml,里面都有注释,大家一看就明白了:

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" >
  3. <generatorConfiguration>
  4. <!-- 引入配置文件 -->
  5. <properties resource="init.properties"/>
  6. <!-- 指定数据连接驱动jar地址 -->
  7. <classPathEntry location="${classPath}" />
  8. <!-- 一个数据库一个context -->
  9. <context id="infoGuardian">
  10. <!-- 注释 -->
  11. <commentGenerator >
  12. <property name="suppressAllComments" value="false"/><!-- 是否取消注释 -->
  13. <property name="suppressDate" value="true" /> <!-- 是否生成注释代时间戳-->
  14. </commentGenerator>
  15. <!-- jdbc连接 -->
  16. <jdbcConnection driverClass="${jdbc_driver}"
  17. connectionURL="${jdbc_url}" userId="${jdbc_user}"
  18. password="${jdbc_password}" />
  19. <!-- 类型转换 -->
  20. <javaTypeResolver>
  21. <!-- 是否使用bigDecimal, false可自动转化以下类型(Long, Integer, Short, etc.) -->
  22. <property name="forceBigDecimals" value="false"/>
  23. </javaTypeResolver>
  24. <!-- 生成实体类地址 -->
  25. <javaModelGenerator targetPackage="com.oop.eksp.user.model"
  26. targetProject="${project}" >
  27. <!-- 是否在当前路径下新加一层schema,eg:fase路径com.oop.eksp.user.model, true:com.oop.eksp.user.model.[schemaName] -->
  28. <property name="enableSubPackages" value="false"/>
  29. <!-- 是否针对string类型的字段在set的时候进行trim调用 -->
  30. <property name="trimStrings" value="true"/>
  31. </javaModelGenerator>
  32. <!-- 生成mapxml文件 -->
  33. <sqlMapGenerator targetPackage="com.oop.eksp.user.data"
  34. targetProject="${project}" >
  35. <!-- 是否在当前路径下新加一层schema,eg:fase路径com.oop.eksp.user.model, true:com.oop.eksp.user.model.[schemaName] -->
  36. <property name="enableSubPackages" value="false" />
  37. </sqlMapGenerator>
  38. <!-- 生成mapxml对应client,也就是接口dao -->
  39. <javaClientGenerator targetPackage="com.oop.eksp.user.data"
  40. targetProject="${project}" type="XMLMAPPER" >
  41. <!-- 是否在当前路径下新加一层schema,eg:fase路径com.oop.eksp.user.model, true:com.oop.eksp.user.model.[schemaName] -->
  42. <property name="enableSubPackages" value="false" />
  43. </javaClientGenerator>
  44. <!-- 配置表信息 -->
  45. <table schema="${jdbc_user}" tableName="s_user"
  46. domainObjectName="UserEntity" enableCountByExample="false"
  47. enableDeleteByExample="false" enableSelectByExample="false"
  48. enableUpdateByExample="false">
  49. <!-- schema即为数据库名 tableName为对应的数据库表 domainObjectName是要生成的实体类 enable*ByExample
  50. 是否生成 example类   -->
  51. <!-- 忽略列,不生成bean 字段 -->
  52. <ignoreColumn column="FRED" />
  53. <!-- 指定列的java数据类型 -->
  54. <columnOverride column="LONG_VARCHAR_FIELD" jdbcType="VARCHAR" />
  55. </table>
  56. </context>
  57. </generatorConfiguration>

附带上我的init.properties

  1. #Mybatis Generator configuration
  2. project = EKSP
  3. classPath=E:/workplace/EKSP/WebContent/WEB-INF/lib/ojdbc14.jar
  4. jdbc_driver = oracle.jdbc.driver.OracleDriver
  5. jdbc_url=jdbc:oracle:thin:@127.0.0.1:1521:orcl
  6. jdbc_user=INFOGUARDIAN
  7. jdbc_password=info_idap132

以上是xml的配置基本情况,大家如果有什么疑问或者建议,敬请评论!

MyBatis Generator generatorConfig.xml配置详解的更多相关文章

  1. [转载]Mybatis Generator最完整配置详解

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE generatorConfiguration ...

  2. mybatis generator的generatorConfig.xml配置详解

    generatorConfig.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ge ...

  3. Mybatis Generator配置文件完整配置详解

    完整的Mybatis Generator(简称MBG)的最完整配置文件,带详解,再也不用去看EN的User Guide了 可以搭配着mybatis generator的中文文档看:http://mbg ...

  4. 【转】Mybatis Generator最完整配置详解

    本文转简书:http://www.jianshu.com/p/e09d2370b796 --> --> <!-- 自动识别数据库关键字,默认false,如果设置为true,根据Sql ...

  5. Mybatis Generator最完整配置详解

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE generatorConfiguration ...

  6. Mybatis Generator 最完整配置详解

    这是从CSDN找到的一篇翻译文章,尝试重新排版后转载. 1. < generatorConfiguration > 标签 1.1 可以用于加载配置项或者配置文件,在整个配置文件中就可以使用 ...

  7. Mybati example generatorConfig.xml 配置详解

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE generatorConfiguration ...

  8. SpringBoot—整合log4j2入门和log4j2.xml配置详解

    关注微信公众号:CodingTechWork,一起学习进步. 引言   对于一个线上程序或者服务而言,重要的是要有日志输出,这样才能方便运维.而日志的输出需要有一定的规划,如日志命名.日志大小,日志分 ...

  9. java web.xml配置详解(转)

    源出处:java web.xml配置详解 1.常规配置:每一个站的WEB-INF下都有一个web.xml的设定文件,它提供了我们站台的配置设定. web.xml定义: .站台的名称和说明 .针对环境参 ...

随机推荐

  1. Threading Module源码概述(二)

    在threading 模块中,提供了列举当前所有子线程的操作.threading.enumerate.这个操作很简单,就是将_active和_limbo中维护的线程集合的信息输出. def enume ...

  2. ReportViewer中设置ServerReport.ReportServerCredentials属性的方法

    当使用SSRS技术来布置报表,可能使用MS自带的ReportViewer控件来读取报表. 它分为Web和Windows两种版本;此处Web版. ServerReport.ReportServerCre ...

  3. javascrip实现无缝滚动

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  4. What is therelationship between @EJB and ejb-ref/ejb-local-ref?

    http://glassfish.java.net/javaee5/ejb/EJB_FAQ.html What is therelationship between @EJB and ejb-ref/ ...

  5. [Angular 2] Validation

    Define a filed should has validation: export class DemoFormSku { myForm: ControlGroup; sku: Abstract ...

  6. 常用颜色大全---RGB值及中英文名称

    ■■■■■ #DC143C Crimson 深红/猩红 ■■■■■ #FFF0F5 LavenderBlush 淡紫红 ■■■■■ #DB7093 PaleVioletRed 弱紫罗兰红 ■■■■■ ...

  7. PHP开发安全之近墨者浅谈(转)

    ==过滤输入/输出转义 过滤是Web应用安全的基础.它是你验证数据合法性的过程.通过在输入时确认对所有的数据进行过滤,你可以避免被污染(未过滤)数据在你的程序中被误信及误用.大多数流行的PHP应用的漏 ...

  8. Meth | phpstorm 2016.2 的最新破解方法(截止2016-8-1)

    今天刚更新了phpstorm 2016.2版本,发现网上提供的破解地址都有问题,即*.lanyus.com及*.qinxi1992.cn下的全部授权服务器已遭JetBrains封杀. 最后网上找到一个 ...

  9. POJ 1039 Pipe 枚举线段相交

    Pipe Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 9493   Accepted: 2877 Description ...

  10. js实现图片上传及预览---------------------->>兼容ie6-8 火狐以及谷歌

    <head runat="server"> <title>图片上传及预览(兼容ie6/7/8 firefox/chrome)</title> & ...