zoukankan      html  css  js  c++  java
  • mybatis generator用法

    1.建好数据库

    2.下载

    http://blog.mybatis.org/p/products.html

    3.取出jar包

    mybatis-generator-core-1.3.2.jar

    4.建造好生成目录

    5.参照下载下来的docs里的文档 写generator.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>
      <classPathEntry location="C:Usersakishimo.m2
    epositorymysqlmysql-connector-java5.1.28mysql-connector-java-5.1.28.jar" />
    
      <context id="DB2Tables" targetRuntime="MyBatis3">
        <jdbcConnection driverClass="com.mysql.jdbc.Driver"
            connectionURL="jdbc:mysql://localhost:3306/test"
            userId="root"
            password="root">
        </jdbcConnection>
    
        <javaTypeResolver >
          <property name="forceBigDecimals" value="false" />
        </javaTypeResolver>
    
        <javaModelGenerator targetPackage="model" targetProject="E:	ools	estGeneratesrc">
          <property name="enableSubPackages" value="true" />
          <property name="trimStrings" value="true" />
        </javaModelGenerator>
    
        <sqlMapGenerator targetPackage="mapping"  targetProject="E:	ools	estGeneratesrc">
          <property name="enableSubPackages" value="true" />
        </sqlMapGenerator>
    
        <javaClientGenerator type="XMLMAPPER" targetPackage="dao"  targetProject="E:	ools	estGeneratesrc">
          <property name="enableSubPackages" value="true" />
        </javaClientGenerator>
    
        <table tableName="user" domainObjectName="User" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>
    
      </context>
    </generatorConfiguration>


    6.执行命令

        java -jar mybatis-generator-core-1.3.2.jar -configfile generator.xml -overwrite

  • 相关阅读:
    团队冲刺(八)
    团队冲刺(七)
    团队冲刺(六)
    Java开发中BASE64Encoder的使用
    解决waiting for target deviceto come online的做法
    团队冲刺(五)
    团队冲刺(四)
    CSS布局 ——从display,position, float属性谈起
    让图表的Y轴 产生几个刻度距离
    CSS行高——line-height 垂直居中等问题
  • 原文地址:https://www.cnblogs.com/Akishimo/p/3515206.html
Copyright © 2011-2022 走看看