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定义: .站台的名称和说明 .针对环境参 ...
随机推荐
- Clouds
1.Eucalyptus: Eucalyptus is a Linux-based software architecture that implements scalable private and ...
- ConcurrentHashMap 原理分析
1 为什么有ConcurrentHashMap hashmap是非线程安全的,hashtable是线程安全的,但是所有的写和读方法都有synchronized,所以同一时间只有一个线程可以持有对象,多 ...
- IE chrome兼容问题
1.关于display显示和隐藏问题 document.getElementById("id").style.display="";//表示显示 documen ...
- DateTime日期格式获取 分类: C# 2014-04-15 10:36 233人阅读 评论(0) 收藏
c#.net 获取时间年月日时分秒格式 //获取日期+时间 DateTime.Now.ToString(); // 2008-9-4 20:02:10 DateTime.Now. ...
- [转载]Android利用convertView优化ListView性能
本的getView写法 Java代码public View getView(int position, View convertView, ViewGroup parent) {View view = ...
- Project Euler:Problem 55 Lychrel numbers
If we take 47, reverse and add, 47 + 74 = 121, which is palindromic. Not all numbers produce palindr ...
- 解决Win8不能上网攻略第二版!三步秒杀原驱动
关于Win8消费者预览版的网卡驱动确实是令人头疼的事情,不少用户都抱怨无法联网而且驱动卸载十分麻烦.IT之家社区luoyousi 此前分享<图文教程:解决Win8消费者预览版不能上网问题> ...
- ASP.NET过滤器、URL重写
过滤器可以对指定的URL访问进行拦截,并执行过滤器的方法,根据实际应用情况,在过滤器中修改请求的代码.判断会话信息,也可以做权限控制. 一:编写过滤器,实现URL重写并配置过滤 编写过滤器,就是编写一 ...
- 滑动页面,顶部导航or顶部 固定在一个位置
现在很多页面 特别是电商用的比较多 比如电商里面某个商品的详细页 往下拉页面 当滚轮到达一定位置的时候 导航栏即固定在顶部 其实他的原理很简单, 就是一开始设置导航为相对定位,然后计算出滚动条离顶部 ...
- js求字符长度
</script> <!DOCTYPE html> <html lang="en"> <head> <meta charset ...