一、目录

按照图片准备下面的东西吧,基础jar,数据链接库的jar。

二、generatorConfig.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="mysql-connector-java-5.1.30.jar"/>
<!-- <classPathEntry location="sqljdbc4.jar"/> -->
<context id="mybatis">
<commentGenerator>
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<!-- <property name="suppressAllComments" value="true" /> -->
<property name="suppressDate" value="true"/>
</commentGenerator> <!-- 数据库连接的信息:驱动类、连接地址、用户名、密码 -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://127.0.0.1:3306/testDb?characterEncoding=utf8" userId="root"
password="">
</jdbcConnection>
<!-- sqlserver的示例 -->
<!--
<jdbcConnection driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver"
connectionURL="jdbc:sqlserver://127.0.0.1;DatabaseName=testDb" userId="root"
password="">
</jdbcConnection>
-->
<javaModelGenerator targetPackage="com.your.real.package.name.model.base"
targetProject="src">
<property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/>
</javaModelGenerator> <sqlMapGenerator targetPackage="com.your.real.package.name.dao.mapper"
targetProject="src">
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator> <javaClientGenerator type="XMLMAPPER"
targetPackage="com.your.real.package.name.dao"
targetProject="src">
<property name="enableSubPackages" value="true"/>
</javaClientGenerator> <!-- tableName:用于自动生成代码的数据库表;domainObjectName:对应于数据库表的javaBean类名 -->
<!-- linux表名区分大小写 -->
<table tableName="test_tb" domainObjectName="TestTb"></table>
</context>
</generatorConfiguration>

三、run.bat

java -jar mybatis-generator-core-1.3..jar -configfile generatorConfig.xml -overwrite
mvn mybatis-generator:generate

Mybatis自动生成的配置实例的更多相关文章

  1. mybatis generator配置,Mybatis自动生成文件配置,Mybatis自动生成实体Bean配置

    mybatis generator配置,Mybatis自动生成文件配置,Mybatis自动生成实体Bean配置 ============================== 蕃薯耀 2018年3月14 ...

  2. mybatis 自动生成文件配置

    maven 依赖配置: <!-- sql server --><dependency> <groupId>com.microsoft.sqlserver</g ...

  3. mybatis自动生成java代码

    SSM框架没有DB+Record模式,写起来特别费劲,只能用下面的方法勉强凑合. 上图中,*.jar为下载的,src为新建的空白目录,.xml配置如下. <?xml version=" ...

  4. Mybatis自动生成实体类

    Maven自动生成实体类需要的jar包 一.pom.xml中 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns ...

  5. 谨慎使用MyBatis自动生成Where语句

    最近监控到类似这样一个慢查询: select XX_time from XXOrderInfo WHERE ( OrderId is not null and OrderId = N'xxxx') x ...

  6. Mybatis自动生成的BO对象继承公共父类(BO中过滤掉公共属性)

    使用mybatis的代码生成工具:mybatis-generator,如果自动生成的BO都有公共的属性,则可以指定这些BO继承父类(父类中定义公共属性) 1.定义父类 注意:属性public,不要使用 ...

  7. 使用mybatis-generator插件结合tk.mybatis自动生成mapper二三事

    本篇文章将介绍使用spring boot框架,引入mybatis-generator插件,结合tk.mybatis自动生成Mapper和Entity的一整套流程,其中包括最重要的踩坑与填坑.     ...

  8. mybatis自动生成model、dao及对应的mapper.xml文件

    背景: 日常开发中,如果新建表,手动敲写model.dao和对应的mapper.xml文件,费时费力且容易出错, 所以采用mybatis自动生成model.dao及对应的mapper.xml文件.代码 ...

  9. mybatis自动生成代码插件mybatis-generator使用流程(亲测可用)

    mybatis-generator是一款在使用mybatis框架时,自动生成model,dao和mapper的工具,很大程度上减少了业务开发人员的手动编码时间 坐着在idea上用maven构建spri ...

随机推荐

  1. 借助JRebel使Tomcat支持热部署

    JRebel是一个J2EE热部署的工具.使用它可以减少浪费8-18%的开发时间在项目的构建和部署上.虽然Java也提供了HotSpot的JVM,但是如果你修改的类中有方法名称变动的话,HotSpot就 ...

  2. Ubuntu下gcc多版本共存和版本切换

    https://my.oschina.net/u/2306127/blog/538139 摘要: Ubuntu系统使用的gcc版本随着发布版本的不同而不同,在编译android系统时不同的版本推荐用不 ...

  3. gdb -Mysql源代码级调试方法

    http://blog.csdn.net/hitzhang/article/details/5985474 gdb -q --batch --ex "set height 0" - ...

  4. 对 dpif_class 结构体的一点认识

         类 dpif_class 抽象的是OVS交换机用户空间和内核层datapath的通信接口(通过netlink),分层是出于性能和生产效率的考虑,通过接口dpif_class,用户层ovs-v ...

  5. java项目怎样添加jar包依赖?

    工程->右键properties->add external jars

  6. N个富文本编辑器/基于Web的HTML编辑器

    转自:http://www.cnblogs.com/lingyuan/archive/2010/11/15/1877447.html 基于WEB的HTML 编辑器,WYSIWYG所见即所得的编辑器,或 ...

  7. OpenCV Harris 角点检测子

    Harris 角点检测子 目标 本教程中我们将涉及: 有哪些特征?它们有什么用? 使用函数 cornerHarris 通过 Harris-Stephens方法检测角点. 理论 有哪些特征? 在计算机视 ...

  8. 创建带Mipmap的osg::Image

    我们常用osgDB::readImage或者osg::Image::allocateImage()方式创建Image对象, 跟深一步的带Mipmap的Image怎样创建呢? 偶然在分析osgParti ...

  9. hadoop常见问题总结1

    本文地址:http://www.cnblogs.com/archimedes/p/hadoop-problem1.html,转载请注明源地址. 问题1:http://localhost:50030 H ...

  10. Cognos清除本地高速缓存的利与弊

    场景:在开发报表初期,往往我们遇到过这种问题,我们手工修改了DB中的测试数据,但是返回报表看,数据还没有更新,难道是设计出问题了?NO,不要慌,这是因为Cognos为了查询效率设计了高速缓存的选项. ...