STS中配置MyBatis代码生成器
1、STS工具菜单项Help > Eclipse Marketplace...
2、输入“mybatis”关键字搜索

3、选择MyBatis Generator 1.3.7进行安装
4、安装成功后重启ide
5、为项目创建mybatis代码生成配置文件

配置如下:
<?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="E:\Maven\hs-MavenRepsitory\repository\mysql\mysql-connector-java\5.1.46\mysql-connector-java-5.1.46.jar"/>
<context id="MySQL" targetRuntime="MyBatis3">
<commentGenerator>
<property name="suppressDate" value="true"/>
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<!--数据库链接URL,用户名、密码 -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/test" userId="root" password="root"/>
<!--是否启用java.math.BigDecimal-->
<javaTypeResolver>
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!-- 生成模型的包名和位置-->
<javaModelGenerator targetPackage="com.lock.spring.boot.blog.model" targetProject="jpa-in-action/src/main/java">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!-- 生成DAO的包名和位置-->
<sqlMapGenerator targetPackage="com.lock.spring.boot.blog.mapper" targetProject="jpa-in-action/src/main/java">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<!-- 生成映射文件的包名和位置-->
<javaClientGenerator targetPackage="com.lock.spring.boot.blog.mapper" targetProject="jpa-in-action/src/main/java" type="XMLMAPPER">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
<table tableName="user" domainObjectName="User" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false">
<property name="useActualColumnNames" value="true"/>
<!-- columnOverride column="???" property="???" /-->
</table>
</context>
</generatorConfiguration>
6、右击配置文件, 选择Run As > Run Mybatis Generator
参考地址:http://www.mybatis.org/generator/running/runningWithEclipse.html
STS中配置MyBatis代码生成器的更多相关文章
- 二、myeclipse中配置mybatis中xml的自动提示
以mybatis中mapper.xml为例 方法一: 步骤一:在mybatis-3.3.0.jar包中寻找mybatis-3-mapper.dtd文件. 可以用360压缩打开mybatis-3.3.0 ...
- STS中搭建SpringMVC工程
1 环境说明 首次接触Spring,面对这么一个优秀的框架,先从环境搞起,再慢慢学.开发环境选择Spring Tool Suite,得专业点不是?Maven选2.2.1,JDK还是1.6,Tomcat ...
- sts中maven
建立一个maven web的工程 网上有很多关于maven的下载,配置等,我这里就不多说了. 下面介绍主要介绍关于在sts中建立一个maven时最开始出现的错误问题. 创建maven工程 file-& ...
- spring中的mybatis的sqlSession是如何做到线程隔离的?
项目中常常使用mybatis配合spring进行数据库操作,但是我们知道,数据的操作是要求做到线程安全的,而且按照原来的jdbc的使用方式,每次操作完成之后都要将连接关闭,但是实际使用中我们并没有这么 ...
- 在springboot中集成mybatis开发
在springboot中利用mybatis框架进行开发需要集成mybatis才能进行开发,那么如何在springboot中集成mybatis呢?按照以下几个步骤就可以实现springboot集成myb ...
- Java EE数据持久化框架 • 【第5章 MyBatis代码生成器和缓存配置】
全部章节 >>>> 本章目录 5.1 配置MyBatis Generator 5.1.1 MyBatis Generator介绍 5.1.2 MyBatis Generat ...
- STS中Maven配置
最近接触maven, 配置过程中记录一下. STS是解压版的,启动后,可以看到已经有了Maven插件, , 但是,STS也同时给你了一个Maven,但是通常不建议使用STS自带的maven.使用默认的 ...
- Spring Boot中使用MyBatis注解配置详解(1)
之前在Spring Boot中整合MyBatis时,采用了注解的配置方式,相信很多人还是比较喜欢这种优雅的方式的,也收到不少读者朋友的反馈和问题,主要集中于针对各种场景下注解如何使用,下面就对几种常见 ...
- mybatis的mapper代理,SqlMapConfig.xml中配置,输入和输出映射使用案例
public class User { private int id; private String username;// 用户姓名 private String sex;// 性别 private ...
随机推荐
- EasyUI 列表展示及基本格式
<html> <head> <meta http-equiv="Content-Type" content="text/html; char ...
- (转) Ringbuffer为什么这么快?
原文地址:http://ifeve.com/ringbuffer/ 最近,我们开源了LMAX Disruptor,它是我们的交易系统吞吐量快(LMAX是一个新型的交易平台,号称能够单线程每秒处理数百万 ...
- Linux Shell 文本处理工具集锦(转载)
内容目录: find 文件查找 grep 文本搜索 xargs 命令行参数转换 sort 排序 uniq 消除重复行 用tr进行转换 cut 按列切分文本 paste 按列拼接文本 wc 统计行和字符 ...
- 浅谈python中的“ ==” 与“ is”
在python中,== 与 is 之间既有区别,又有联系,本文将通过实际代码的演示,力争能够帮助读到这篇文章的朋友以最短的时间理清二者的关系,并深刻理解它们在内存中的实现机制.扯淡的话不多说,下面马上 ...
- 删除排序数组中的重复数字 II · Remove Duplicates from Sorted Array II
重复一次 [抄题]: 给定一个排序数组,在原数组中删除重复出现的数字,使得每个元素只出现一次,并且返回新的数组的长度. 不要使用额外的数组空间,必须在原地没有额外空间的条件下完成. [思维问题]: [ ...
- 关于block元素和inline元素
呃...这个会不会太基础了.最近在复习,所以基础知识也不能够忽略. 根据HTML 4.01 规范,其描述如下(http://www.w3.org/TR/html401/struct/global.ht ...
- 用递归方法求 n!
#include <iostream> using namespace std; #define LL long long LL fac(int n) { LL f; || n == ) ...
- Laravel 5.4+Vue.js 初体验:Laravel下配置运行Vue.js
生产材料PHP:PHP 5.6+Laravel 5.4:https://github.com/laravel/laravel/releases/Composer:http://getcomposer. ...
- centos7 编译安装mysql
centos 7 安装mySql 1,准备mySql源码安装 #wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.23.tar ...
- Oracle SQL 硬解析和子游标
Oracle SQL 硬解析和子游标 What reasons will be happening sql hard parse and generating new child cursors 在一 ...