zoukankan      html  css  js  c++  java
  • mybatis 代码生成器配置

    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----------无法完成自动生成代码,后改为文件中名称后,可正常生成代码,

    具体原因不详。

  • 相关阅读:
    GdiPlus[34]: IGPGraphicsPath (一)
    GdiPlus[33]: 基本绘图与填充命令
    GdiPlus[29]: IGPPen: 虚线样式
    [征询意见]博客园logo
    [公告]网站恢复正常运行
    [公告]博客园将与博文视点合作推出一系列.NET图书
    [公告]由Bruce Zhang负责博客园的出书工作
    通过Windows Live Alerts订阅博客园首页RSS
    [征询意见]博客园新logo
    [新功能]新闻管理
  • 原文地址:https://www.cnblogs.com/xcggdd/p/7113292.html
Copyright © 2011-2022 走看看