码迷,mamicode.com
首页 > 其他好文 > 详细

mybatis 代码生成器配置

时间:2017-07-03 23:58:03      阅读:450      评论:0      收藏:0      [点我收藏+]

标签:trim   amp   bat   jdbc   包名   tor   nts   new   1.0   

eclipse安装插件,new,新建一个Mybatis Generator Configuration File

文件内容:

<?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>
  <!--路径中不能包含中文--> <classPathEntry location="F:/NJmrk/mysql-connector-java-5.1.41.jar"/> <context id="mysql_table" targetRuntime="MyBatis3"> <commentGenerator> <property name="suppressDate" value="true" /> <!-- 是否去除自动生成的注释 true:是 : false:否 --> <property name="suppressAllComments" value="true" /> </commentGenerator> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/demo" userId="root" password="123456"> </jdbcConnection> <javaTypeResolver> <property name="forceBigDecimals" value="false" /> </javaTypeResolver> <javaModelGenerator targetPackage="com.xi.entity" targetProject="zhibing_mybatis/src/main/java"> <property name="enableSubPackages" value="true" /> <property name="trimStrings" value="true" /> </javaModelGenerator> <!-- 生成映射文件的包名和位置 --> <sqlMapGenerator targetPackage="com.xi.mapping" targetProject="zhibing_mybatis/src/main/java"> <property name="enableSubPackages" value="true" /> </sqlMapGenerator> <!-- 生成DAO的包名和位置 --> <javaClientGenerator type="XMLMAPPER" targetPackage="com.xi.dao" targetProject="zhibing_mybatis/src/main/java"> <property name="enableSubPackages" value="true" /> </javaClientGenerator> <!-- 要生成的实体和对应的来源表 --> <table tableName="mdept" domainObjectName="Dept" enableCountByExample="false" enableDeleteByExample="false" enableSelectByExample="false" enableUpdateByExample="false"> <property name="useActualColumnNames" value="true" /> </table> <!-- <table schema="???" tableName="???"> <columnOverride column="???" property="???" /> </table> --> </context> </generatorConfiguration>

配置文件中,包名,开始的时候是:generator.dao,generator.entity,generator.mapping----------无法完成自动生成代码,后改为文件中名称后,可正常生成代码,

具体原因不详。

mybatis 代码生成器配置

标签:trim   amp   bat   jdbc   包名   tor   nts   new   1.0   

原文地址:http://www.cnblogs.com/xcggdd/p/7113292.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!