配置需注意2点,

1.对于匹配所有表用%,多表配合使用_和%,这个和SQL Like查询模糊匹配方法一致

2.配置报错的话,提示如下:标黄的部分其实是正则表达式

The content of element type "context" is incomplete, it must match
"(property*,plugin*,commentGenerator?,(connectionFactory|
jdbcConnection),javaTypeResolver?,javaModelGenerator,sqlMapGenerator?,javaClientGenerator?,table+)".

真实项目范例:

 <?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>
<!--<properties resource="application.properties"/>--> <context id="Mysql" targetRuntime="MyBatis3Simple" defaultModelType="flat">
<property name="beginningDelimiter" value="`"/>
<property name="endingDelimiter" value="`"/> <!-- 数据源配置开始 -->
<plugin type="tk.mybatis.mapper.generator.MapperPlugin">
<property name="mappers" value="com.qfpie.server.util.QkMapper"/>
</plugin>
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://172.**.**.**:3306/qone"
userId="qkapp"
password="*********">
</jdbcConnection> <javaModelGenerator targetPackage="com.qfpie.server.model.qone" targetProject="src/main/java"/>
<sqlMapGenerator targetPackage="mapper.qone" targetProject="src/main/resources"/>
<javaClientGenerator targetPackage="com.qfpie.server.mapper.mysql.qone" targetProject="src/main/java"
type="XMLMAPPER"/> <!-- 数据源配置结束 --> <table tableName="cobra_text" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<!--% 表示全部表-->
<!--mysql 配置-->
<generatedKey column="ID" sqlStatement="Mysql" identity="true"/>
<!--oracle 配置-->
<!-- <generatedKey column="ID" sqlStatement="select SEQ_{1}.nextval from dual" identity="false" type="pre"/> -->
</table>
</context>
</generatorConfiguration>

MBG(Mybatis Generator)配置的更多相关文章

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

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

  2. spring boot集成mybatis(3) - mybatis generator 配置

    Spring Boot 集成教程 Spring Boot 介绍 Spring Boot 开发环境搭建(Eclipse) Spring Boot Hello World (restful接口)例子 sp ...

  3. MyBatis Generator配置示例

    (一).MBG介绍 MyBatis Generator(MBG)是一个Mybatis的代码生成器,它可以用来生成可以访问(多个)表的基础对象.MBG解决了对数据库操作有最大影响的一些简单的CRUD(插 ...

  4. Mybatis Generator配置详解

    参考:http://www.jianshu.com/p/e09d2370b796 http://mbg.cndocs.tk <?xml version="1.0" encod ...

  5. Mybatis generator配置

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE generatorConfiguration ...

  6. mybatis generator配置生成代码的问题

    接触第二种orm两天下来,一脸懵逼.mybatis是大多数公司所推崇的,相比于hibernate性能较为好的,操作更为方便的轻量级工具,所以小富就搞起这个orm.好吧,都说mybatis有个配置可以自 ...

  7. MyBatis generator配置 overwrite 文件覆盖失效

    工具:IDEA.jdk1.8.mysql 底部有解决方法! pom.xml配置 <plugins> <!--Mybatis自动代码插入--> <plugin> &l ...

  8. Mybatis generator 配置

    mybatis-generator.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ...

  9. 使用Java代码配置MyBatis Generator

    使用MyBatis Generator生成器时,有时候没办法使用xml型的配置文件,比如将Maven项目设置成pom打包方式(<packaging>pom</packaging> ...

随机推荐

  1. 02.提交bug

    写代码最烦的也就是修复bug了,虽然这个避无可避…………………… a. bug的严重级别设置 1级:影响主要流程 ->在bug 的影响下,主流程 测试无法向下进行 2级:影响核心功能 -> ...

  2. w10环境下Hexo博客搭建

    w10使用hexo+github手把手搭建自己的第一个博客 对一个程序员来说,博客的重要性不言而喻,不但可以积累知识,还可以更好的给别人分享自己的心得.今天就以时下比较流行的hexo博客搭建属于自己的 ...

  3. 【VS开发】【数据库开发】libevent简单入门和介绍

    libevent是一个基于事件触发的网络库,memcached底层也是使用libevent库,今天学习下. 总体来说,libevent有下面一些特点和优势: * 统一数据源, 统一I/O事件,信号和定 ...

  4. 打开app应用

    =========================================人才网 <!--app底部浮动广告--><style> footer { padding-bo ...

  5. vue {{}}的用法

    参考链接:https://blog.csdn.net/cofecode/article/details/78666233

  6. Go之gob包的使用

    gob包("encoding/gob")管理gob流——在encoder(编码器,也就是发送器)和decoder(解码器,也就是接受器)之间交换的字节流数据(gob 就是 go b ...

  7. vba Excel连接数据库

    PostgreSql: 第一步 在网上下载postres的驱动程序,之后安装,下载地址:https://www.devart.com/odbc/postgresql/download.html 第二步 ...

  8. python 创建虚拟环境时报错OSError, setuptools下载失败

    错误信息如下: Using base prefix 'c:\\users\\huful\\appdata\\local\\programs\\python\\python36-32'New pytho ...

  9. Hadoop Join

    1. Reduce Join工作原理 Map端的主要工作:为来自不同表或文件的key/value对,打标签以区别不同来源的记录.然后用连接字段作为key,其余部分和新加的标志作为value,最后进行输 ...

  10. Oracle日常

    Xmltype select extractvalue(value(x), '//utext') value from table(XMLSEQUENCE(extract(v_xmlContent, ...