mybatis
Mybatis
gblfy
心如向阳,次第花开!
展开
-
mybatis使用truncate清除表数据
@Update("truncate table #{}")void truncate(@pa);<!-- 清空表数据 --><update id="truncateTable">truncate table ${tableName}</update>原创 2021-06-30 12:58:42 · 9008 阅读 · 4 评论 -
mybatis:在springboot中的配置
Mybatis 配置使全局的映射器启用或禁用缓存。mybatis.configuration.cache-enabled=true全局启用或禁用延迟加载。当禁用时,所有关联对象都会即时加载。mybatis.configuration.lazy-loading-enabled=true当启用时,有延迟加载属性的对象在被调用时将会完全加载任意属性。否则,每种属性将会按需要加载。mybatis.configuration.aggressive-lazy-loading=true是否允许单条sql原创 2020-12-22 21:33:32 · 758 阅读 · 0 评论 -
通过接口操作MyBatis及数据库配置文件
优点:不用每次实例化SqlSession配置优于硬编码减少sql书写错误的概率规范代码,面向接口服务文章目录一、回顾二、如何通过接口操作MyBatis2.1. 文件结构2.2. 依赖jar包2.3. 表结构2.4. mybatis配置文件2.5. db配置文件2.6. 获取SqlSession工具类2.7. 基础常量类2.8. 增删改查案例2.9. 基础文件2.10. 源码地址一、回顾为什么要通过接口操作MyBatis?在以往的情况下,我们通过MyBatis操作数据库,每执行.原创 2020-12-18 13:35:58 · 284 阅读 · 1 评论 -
Mybatis代码生成适配Oracle和Mysql数据库_01
文章目录1. 依赖2. generatorConfig.xml开源项目地址:https://gitee.com/gb_90/Oracle_Mysql_GenerateGit克隆方式: git clone [email protected]:gb_90/Oracle_Mysql_Generate.git1. 依赖<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0原创 2020-05-15 16:17:40 · 543 阅读 · 0 评论 -
mybatis 插入数据后返回自增id
useGeneratedKeys="true" keyProperty="id">sql全部内容:<insert id="insertSelective" parameterType="com.gblfy.mall.pojo.Shipping" useGeneratedKeys="true" keyProperty="id"> insert into mall_sh...原创 2020-03-20 09:17:16 · 289 阅读 · 0 评论 -
Mybatis Generator 配置详解
许多人在Java项目中都会到使用Mybatis Generator这个工具包,这里把这个工具的配置完整列一下:<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1...原创 2020-03-15 15:37:31 · 219 阅读 · 0 评论 -
Cannot obtain primary key information from the database, generated objects may be incomplete
问题描述在整合mybatis时只是生成了两个insert()函数,并且提示[WARNING] Cannot obtain primary key information from the database, generated objects may be incomplete解决方法在jdbc连接url上加nullCatalogMeansCurrent=trueurl=jdbc:mys...原创 2020-02-15 19:44:01 · 486 阅读 · 0 评论