Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception is no longer DuplicateKeyException when the unique key conflict #520

Closed
moccanism opened this issue Dec 27, 2017 · 2 comments
Closed

Comments

@moccanism
Copy link

Please answer these questions before submitting your issue. Thanks!

Which version of Sharding-Jdbc do you using?

2.0.1

Expected behavior

引入分表后,业务代码应该无侵害或者无修改。而且唯一键冲突catch到DuplicateKeyException是比较合理的。

Actual behavior

引入分表后,唯一键异常从DuplicateKeyException变为MyBatisSystemException

Steps to reproduce the behavior

只配置了读写分离,连续插入两条相同数据,引发唯一键冲突,此时正常catch到DuplicateKeyException;
配置文件改为读写分离+分表,同样连续插入两条相同数据,异常变为MyBatisSystemException

Please provide the reproduce example codes (such as github link) if possible.

https://github.com/moccanism/shardingjdbc-issue-demo

根据自己的DB环境更改url -> 使用database.sql建表 -> 切换profile运行

@moccanism
Copy link
Author

特别说明一下:
1、tb_mch_account_info_log表并没有分表;
2、yml里面是另外一张表配置了分表,这个case中没有涉及到这个分表,单纯对tb_mch_account_info_log进行insert

@haocao haocao closed this as completed in fb66859 Dec 28, 2017
@terrymanu terrymanu changed the title 引入分表后,唯一键冲突时异常类型不再是DuplicateKeyException Exception is no longer DuplicateKeyException when the unique key conflict Aug 8, 2018
@terrymanu
Copy link
Member

fixed at 2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants