一、目录

按照图片准备下面的东西吧,基础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. Cascode MOSFET increases boost regulator's input- and output-voltage ranges

    Targeting use in portable-system applications that require raising a battery's voltage to a higher l ...

  2. DC-DC converter Control techniques

    As shown in figure 3.4, PWM controller contains two main parts; voltage error-amplifier and voltage ...

  3. SpringMVC 学习笔记(二) @RequestMapping、@PathVariable等注解

    版权声明:本文为博主原创文章,博客地址:http://blog.csdn.net/a67474506?viewmode=contents 1.1. @RequestMapping映射请求 Spring ...

  4. [Xarmrin.IOS]使用Build Host 在Windows上建置IOS程式及DeBug

    使用Xamarin開發IOS程式時, 必須要在Mac上才可以編譯程式,若想在windows系統上編譯,則可透過Build host的方式, 但還是要有一台Mac的電腦就是了XD 首先你的Mac必須要已 ...

  5. myeclipse 8.5破解方法

    转自:  http://blog.sina.com.cn/s/blog_70600f7201018pib.html , 记录下来存档 Step: 1.建立一个任意名称的Java Project 2.在 ...

  6. setTimeOut传參数

    function blink(e_Id, second) {var soccer = document.getElementById(e_Id); soccer.style.visibility = ...

  7. windows下gVim(Vi/vim)基本使用

    Vim 是一个Linux 平台上功能非常强大的编辑器,他是早年的Vi 编辑器的加强版.这个gVim 是windows 版的,并且有了标准的windows 风格的图形界面,所以叫g(graphical) ...

  8. 排查Hive报错:org.apache.hadoop.hive.serde2.SerDeException: java.io.IOException: Start of Array expected

    CREATE TABLE json_nested_test ( count string, usage string, pkg map<string,string>, languages ...

  9. 双sonar的cache问题

  10. 在Ubuntu 13.04下的安装eclipse

    来源:http://www.cnblogs.com/lanxuezaipiao/p/3325628.html 一.eclipse安装过程 首先确保在安装eclipse之前已经安装好Java虚拟机 1. ...