MyBatis Generator generatorConfig.xml配置详解
所有Generator的xml详细说明见:http://mybatis.org/generator/configreference/xmlconfig.html (英文版)
引用 http://blog.csdn.net/pk490525/article/details/16819307
现在针对generatorConfig.xml配置进行解说,至于其内部元素的详解见英文文档,贴上xml,里面都有注释,大家一看就明白了:
- <?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"/>
- <!-- 指定数据连接驱动jar地址 -->
- <classPathEntry location="${classPath}" />
- <!-- 一个数据库一个context -->
- <context id="infoGuardian">
- <!-- 注释 -->
- <commentGenerator >
- <property name="suppressAllComments" value="false"/><!-- 是否取消注释 -->
- <property name="suppressDate" value="true" /> <!-- 是否生成注释代时间戳-->
- </commentGenerator>
- <!-- jdbc连接 -->
- <jdbcConnection driverClass="${jdbc_driver}"
- connectionURL="${jdbc_url}" userId="${jdbc_user}"
- password="${jdbc_password}" />
- <!-- 类型转换 -->
- <javaTypeResolver>
- <!-- 是否使用bigDecimal, false可自动转化以下类型(Long, Integer, Short, etc.) -->
- <property name="forceBigDecimals" value="false"/>
- </javaTypeResolver>
- <!-- 生成实体类地址 -->
- <javaModelGenerator targetPackage="com.oop.eksp.user.model"
- targetProject="${project}" >
- <!-- 是否在当前路径下新加一层schema,eg:fase路径com.oop.eksp.user.model, true:com.oop.eksp.user.model.[schemaName] -->
- <property name="enableSubPackages" value="false"/>
- <!-- 是否针对string类型的字段在set的时候进行trim调用 -->
- <property name="trimStrings" value="true"/>
- </javaModelGenerator>
- <!-- 生成mapxml文件 -->
- <sqlMapGenerator targetPackage="com.oop.eksp.user.data"
- targetProject="${project}" >
- <!-- 是否在当前路径下新加一层schema,eg:fase路径com.oop.eksp.user.model, true:com.oop.eksp.user.model.[schemaName] -->
- <property name="enableSubPackages" value="false" />
- </sqlMapGenerator>
- <!-- 生成mapxml对应client,也就是接口dao -->
- <javaClientGenerator targetPackage="com.oop.eksp.user.data"
- targetProject="${project}" type="XMLMAPPER" >
- <!-- 是否在当前路径下新加一层schema,eg:fase路径com.oop.eksp.user.model, true:com.oop.eksp.user.model.[schemaName] -->
- <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类 -->
- <!-- 忽略列,不生成bean 字段 -->
- <ignoreColumn column="FRED" />
- <!-- 指定列的java数据类型 -->
- <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 Generator generatorConfig.xml配置详解的更多相关文章
- [转载]Mybatis Generator最完整配置详解
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE generatorConfiguration ...
- mybatis generator的generatorConfig.xml配置详解
generatorConfig.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ge ...
- Mybatis Generator配置文件完整配置详解
完整的Mybatis Generator(简称MBG)的最完整配置文件,带详解,再也不用去看EN的User Guide了 可以搭配着mybatis generator的中文文档看:http://mbg ...
- 【转】Mybatis Generator最完整配置详解
本文转简书:http://www.jianshu.com/p/e09d2370b796 --> --> <!-- 自动识别数据库关键字,默认false,如果设置为true,根据Sql ...
- Mybatis Generator最完整配置详解
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE generatorConfiguration ...
- Mybatis Generator 最完整配置详解
这是从CSDN找到的一篇翻译文章,尝试重新排版后转载. 1. < generatorConfiguration > 标签 1.1 可以用于加载配置项或者配置文件,在整个配置文件中就可以使用 ...
- Mybati example generatorConfig.xml 配置详解
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE generatorConfiguration ...
- SpringBoot—整合log4j2入门和log4j2.xml配置详解
关注微信公众号:CodingTechWork,一起学习进步. 引言 对于一个线上程序或者服务而言,重要的是要有日志输出,这样才能方便运维.而日志的输出需要有一定的规划,如日志命名.日志大小,日志分 ...
- java web.xml配置详解(转)
源出处:java web.xml配置详解 1.常规配置:每一个站的WEB-INF下都有一个web.xml的设定文件,它提供了我们站台的配置设定. web.xml定义: .站台的名称和说明 .针对环境参 ...
随机推荐
- Threading Module源码概述(二)
在threading 模块中,提供了列举当前所有子线程的操作.threading.enumerate.这个操作很简单,就是将_active和_limbo中维护的线程集合的信息输出. def enume ...
- ReportViewer中设置ServerReport.ReportServerCredentials属性的方法
当使用SSRS技术来布置报表,可能使用MS自带的ReportViewer控件来读取报表. 它分为Web和Windows两种版本;此处Web版. ServerReport.ReportServerCre ...
- javascrip实现无缝滚动
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 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/ ...
- [Angular 2] Validation
Define a filed should has validation: export class DemoFormSku { myForm: ControlGroup; sku: Abstract ...
- 常用颜色大全---RGB值及中英文名称
■■■■■ #DC143C Crimson 深红/猩红 ■■■■■ #FFF0F5 LavenderBlush 淡紫红 ■■■■■ #DB7093 PaleVioletRed 弱紫罗兰红 ■■■■■ ...
- PHP开发安全之近墨者浅谈(转)
==过滤输入/输出转义 过滤是Web应用安全的基础.它是你验证数据合法性的过程.通过在输入时确认对所有的数据进行过滤,你可以避免被污染(未过滤)数据在你的程序中被误信及误用.大多数流行的PHP应用的漏 ...
- Meth | phpstorm 2016.2 的最新破解方法(截止2016-8-1)
今天刚更新了phpstorm 2016.2版本,发现网上提供的破解地址都有问题,即*.lanyus.com及*.qinxi1992.cn下的全部授权服务器已遭JetBrains封杀. 最后网上找到一个 ...
- POJ 1039 Pipe 枚举线段相交
Pipe Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 9493 Accepted: 2877 Description ...
- js实现图片上传及预览---------------------->>兼容ie6-8 火狐以及谷歌
<head runat="server"> <title>图片上传及预览(兼容ie6/7/8 firefox/chrome)</title> & ...