Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get primary keys after batch insert in MyBatis

Tags:

mybatis

use annotation @Options(useGeneratedKeys = true, keyProperty = "id") to get the generated primary key for single insert is fine for me , but when I use annotation @InsertProvider to make a batch insert , I have no idea how to get the generated primary keys , any comments will be appreciated . thx in advance

like image 527
Kane.Sun Avatar asked Oct 18 '25 15:10

Kane.Sun


1 Answers

Now Mybatis 3.3.1 had supported it. Please see https://github.com/mybatis/mybatis-3/pull/547

like image 140
zhuguowei Avatar answered Oct 22 '25 06:10

zhuguowei