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

    具体原因不详。

  • 相关阅读:
    Markdown语法入门
    Android开发——绘图基础
    数据结构(java版)学习笔记(三)——线性表之单链表
    数据结构(java版)学习笔记(二)——线性表之顺序表
    数据结构(java版)学习笔记(一)——线性表
    优化电脑方法收集(一)——加内存系统没变化?改几项注册表再感受下
    数据结构(java版)学习笔记(序章)
    基础:从概念理解Lucene的Index(索引)文档模型
    lucene之排序、设置权重、优化、分布式搜索(转)
    Lucene提供的条件判断查询
  • 原文地址:https://www.cnblogs.com/xcggdd/p/7113292.html
Copyright © 2011-2022 走看看