shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

sharding jdbc, when insert config useGeneratedKeys , in one Transactional , the ID obtained by batch insertion is the first one! How to solve this problem

Open jiuye9999 opened this issue 3 years ago • 6 comments

Question

For English only, other languages will not accept.

Before asking a question, make sure you have:

Please pay attention on issues you submitted, because we maybe need more details. If no response anymore and we cannot reproduce it on current information, we will close it.

jiuye9999 avatar Dec 01 '23 03:12 jiuye9999

mysql sql: insert into bdf_teacher (teacher_name, class_id) values (#{teacherName}, #{classId})

jiuye9999 avatar Dec 01 '23 03:12 jiuye9999

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.

github-actions[bot] avatar Dec 31 '23 20:12 github-actions[bot]

mysql sql: insert into bdf_teacher (teacher_name, class_id) values (#{teacherName}, #{classId})

I encountered the same issue in sharding-jdbc 4.1.1. Based on my analysis, it was because in org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement#prepare, only the lastId was retrieved. I'm not sure about the rationale behind this design. However, when I upgraded to sharding-jdbc 5, this issue was fixed. The relevant method involved is org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement#createExecutionContext.

bingo906 avatar Apr 24 '24 02:04 bingo906

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.

github-actions[bot] avatar May 24 '24 20:05 github-actions[bot]

The version 4.1.1 is out of service, please try version 5.5.x

terrymanu avatar Jul 07 '24 04:07 terrymanu

you may write issues of version 4.1.1 here :https://gitee.com/shardcn/shardingsphere_4.1.1

shardcn avatar Oct 15 '24 08:10 shardcn