Home >Database >Mysql Tutorial >mybatis多线程批量插入MySQL报主键冲突

mybatis多线程批量插入MySQL报主键冲突

WBOY
WBOYOriginal
2016-06-06 09:41:532685browse

多线程mybatismysql主键


insert into SMS_DOWN_HISTORY(templateCode,activityCode,activityId,sendRoundId,arrangeDate,expireDate,messageId,mobile,requestId,senderId,depName,depId,flag,level,smsTemplateVar,systemName,mtime,ctime)
values

(#{item.templateCode},#{item.activityCode},#{item.activityId},#{item.sendRoundId},#{item.arrangeDate},#{item.expireDate},#{item.messageId},#{item.mobile},#{item.requestId},#{item.senderId},#{item.depName},#{item.depId},#{item.flag},#{item.level},#{item.smsTemplateVar},#{item.systemName},#{item.mtime},#{item.ctime})


以上是我的SQL语句,在多线程的请求下就会报主键冲突异常,并且并发量越大主键冲突异常就越频繁。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn