Mybatis插入语句useGeneratedKeys="true"的用法
<!-- 插入新的问题件 -->
<!-- useGeneratedKeys="true"把新增加的主键赋值到自己定义的keyProperty(id)中 -->
<insert id="insert" parameterType="jw.base.entity.WrongRecApply" useGeneratedKeys="true" keyProperty="id" >
insert into tb_wrong_rec_apply (num, cid,
`type`, `describe`, solution,
seller_tel, seller_qq, seller_email,
buyer_tel, buyer_qq, buyer_email,
submit_time, update_time, r_wrong_id,
ext1, ext2, img,state
)
values (#{num,jdbcType=VARCHAR}, #{cid,jdbcType=INTEGER},
#{type,jdbcType=VARCHAR}, #{describe,jdbcType=VARCHAR}, #{solution,jdbcType=VARCHAR},
#{sellerTel,jdbcType=VARCHAR}, #{sellerQq,jdbcType=VARCHAR}, #{sellerEmail,jdbcType=VARCHAR},
#{buyerTel,jdbcType=VARCHAR}, #{buyerQq,jdbcType=VARCHAR}, #{buyerEmail,jdbcType=VARCHAR},
#{submitTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{rWrongId,jdbcType=INTEGER},
#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{img,jdbcType=LONGVARBINARY},#{state,jdbcType=INTEGER}
)
</insert>
useGeneratedKeys 取值范围true|false 默认值是:false。 含义:设置是否使用JDBC的getGenereatedKeys方法获取主键并赋值到keyProperty设置的领域模型属性中。
Mybatis插入语句useGeneratedKeys="true"的用法的更多相关文章
- mybatis 插入语句name no find
1.可参考连接:https://www.cnblogs.com/thomas12112406/p/6217211.html 2.dao层的配置 void addUser(@Param("un ...
- mybatis 插入语句 返回自增长id方法
背景:目前有个插入语句需要获取插入记录的id 因为id是自增长的,所以要在插入后返回这个id 错误1: mapper.xml: <!-- 新增 返回自增长id--> <insert ...
- MyBatis插入语句返回主键值
插入语句xml代码: <insert id="insertUser" parameterType="com.spring.mybatis.po.User" ...
- mybatis插入语句空值没有设置jdbcType报错
Exception in thread "main" org.springframework.jdbc.UncategorizedSQLException: Error setti ...
- mybatis插入是返回主键id
<!-- 插入数据:返回记录的id值 --> <insert id="insertOneTest" parameterType="org.chench. ...
- Mybatis各语句高级用法(未完待续)
更多的语法请参考官网 http://www.mybatis.org/mybatis-3/dynamic-sql.html# 环境:MySQL5.6,jdk1.8 建议:所有的参数加上@Param re ...
- MyBatis的动态插入语句(经常报‘无效的列类型’)
最近在工作中经常遇到一个情况:通过mybatis的标签执行插入语句,当表中字段比较多的时候,需要全部插入,而有时候的需求是只插入其中几个字段,但是会报错. 原来的语句,必须把所有字段都Set值. &l ...
- mybatis <!-- useGeneratedKeys="true"把新增加的主键赋值到自己定义的keyProperty(id)中 -->
<!-- useGeneratedKeys="true"把新增加的主键赋值到自己定义的keyProperty(id)中 -->
- mybatis使用@Insert @SelectKey 执行插入语句时获得主键自增长值(转)
@Insert(" insert into table(c1,c2) " + " values (#{c1},#{c2}) ") @SelectKey(resu ...
随机推荐
- 01.Net入门知识
1..Net学习路线及几个容易混淆的概念 .Net只是一个平台,提供运行.Net程序需要的虚拟机.类库等 C#就是.Net平台下的一个开发语言,.Net下的语言还有VB.Net.PowerShell等 ...
- EBS与FMW集成工作流管理器的检查
工作流管理器的检查点(DB层面): --1:数据库job aq参数设置,建议设置job_queue_processes>=10 select p.NAME,p.DESCRIPTION,p.VAL ...
- Testlink接口使用方法-python语言远程调用
deepin@deepin-pc:~/test$ cat libclienttestlink.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- #! ...
- 总结:ARM逻辑和高级C(朱老师物联网学习)
开始学习朱老师物联网的视频是国庆节的那几天开始的,刚刚开始的时候是想自己在网上找一些嵌入式方面的视频资料,也找了很多的资料臂如“国嵌视频”“达内的视频”,之后也化了十几块钱在淘宝上面买了几十个G的视频 ...
- bestcoder单调区间
http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=584&pid=1006 题解:ORZ Matrix67 ht ...
- 触摸事件 - UIControlEvents
首先,UIControlEvents有这个几种: UIControlEventTouchDown = 1 << 0, // on all touch dow ...
- 『Python』 多线程 共享变量的实现
简介: 对于Python2而言,对于一个全局变量,你的函数里如果只使用到了它的值,而没有对其赋值(指a = XXX这种写法)的话,就不需要声明global. 相反,如果你对其赋了值的话,那么你就需要声 ...
- jquery validate 自定义验证方法 日期验证
jquery validate有很多验证规则,但是更多的时候,需要根据特定的情况进行自定义验证规则. 这里就来聊一聊jquery validate的自定义验证. jquery validate有一个方 ...
- POJ1068 Parencodings(模拟)
题目链接. 分析: 水题. #include <iostream> #include <cstdio> #include <cstring> using names ...
- C++: Command Line Processing
Save this code here for studying and using it. Surce code is here. CmdLine.h File #pragma once #incl ...