• mybatis-使用generator反向数据库表并生成dao和mapping映射


     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <!DOCTYPE generatorConfiguration
     3   PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
     4   "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
     5 <!--生成命令:java -jar mybatis-generator-core-1.3.1.jar -configfile mybatis-generator.xml  -overwrite -->
     6 <generatorConfiguration>
     7 
     8         <classPathEntry location="D:/generator/ojdbc14.jar" />
     9         <context id="WS_Tables" targetRuntime="MyBatis3">
    10              <commentGenerator>
    11                 <property name="suppressAllComments" value="true"/>
    12              </commentGenerator>
    13              
    14 
    15              <jdbcConnection driverClass="oracle.jdbc.OracleDriver" connectionURL="jdbc:oracle:thin:@192.168.1.110:1521:duwenlei" userId="system" password="du"></jdbcConnection>
    16              <javaTypeResolver>
    17                  <property name="forceBigDecimais" value="false"/>
    18              </javaTypeResolver>
    19              
    20 
    21              <javaModelGenerator targetPackage="sy.model" targetProject="D:/generator/src">
    22                  <property name="enableSubPackages" value="true"/>
    23                  <property name="trimStrings" value="true"/>
    24              </javaModelGenerator>
    25              
    26 
    27              <sqlMapGenerator targetPackage="sy.mapping" targetProject="D:/generator/src">
    28                  <property name="enableSubPackages" value="true"/>
    29              </sqlMapGenerator>
    30              
    31 
    32              <javaClientGenerator targetPackage="sy.dao" type="XMLMAPPER" targetProject="D:/generator/src">
    33                  <property name="enableSubPackages" value="true"/>
    34              </javaClientGenerator>
    35              
    36 
    37              <table tableName="user_" domainObjectName="User" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
    38         </context>
    39 </generatorConfiguration>

    注意:所有的targetProject="D:/generator/src",不要包含中文名称,要不然会一堆乱码
      需要用到数据库驱动

                 mybatis-generator-core-1.3.2.jar两个jar文件。

    如果有使用请标明来源:http://www.cnblogs.com/duwenlei/
  • 相关阅读:
    进程间通讯,线程间通讯
    进程与线程
    学习自测6.0
    学习自测5.0
    学习自测4.0
    学习自测3.0
    学习自测2.0
    学习自测1.0
    PS中怎么复制某个图层的效果?
    初学前端犯下的错误(用于反省)
  • 原文地址:https://www.cnblogs.com/duwenlei/p/3519392.html
Copyright © 2020-2023  润新知