seata 复合主建自增表结构,插入多行数据且未携带主键值时执行异常

nwwlzxa7  于 3个月前  发布在  其他
关注(0)|答案(2)|浏览(87)
  • I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

Ⅱ. Describe what happened

If there is an exception, please attach the exception trace:

Just paste your stack trace here!

Ⅲ. Describe what you expected to happen

Ⅳ. How to reproduce it (as minimally and precisely as possible)

表结构:
CREATE TABLE t_multi_primary (
id1 int(11) NOT NULL AUTO_INCREMENT,
id2 int(11) NOT NULL,
a int(11) DEFAULT NULL,
b int(11) DEFAULT NULL,
PRIMARY KEY ( id1 , id2 )
) ENGINE=InnoDB;
测试case语句:
insert into t_multi_primary(id1,id2,a,b) values(null,2,1,1),(null,3,2,2)
问题原因:

获取自增主键时,两行数据应该是两个自增主键值,但在复合主键下只获取到了一个

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

  • JDK version :
  • Seata version:
  • OS :
  • Others:
c7rzv4ha

c7rzv4ha1#

这个问题可能跟driver有关,无法返回多行pk,某些数据库的driver就有这个问题,还需要框架层去通过步长计算pk

相关问题