Skip to content

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

Closed
@moccanism

Description

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运行

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions