Bug #65904 Connector/J (JDBC): Special exception subclass for duplicate key constraint
Submitted: 16 Jul 2012 2:01 Modified: 16 Jul 2012 4:04
Reporter: Ondra Zizka Email Updates:
Status: Verified Impact on me:
Category:Connector / J Severity:S4 (Feature request)
Version:5.1.21 OS:Any
Assigned to: Alexander Soklakov CPU Architecture:Any

[16 Jul 2012 2:01] Ondra Zizka
Violating duplicate key constraint is quite common state. For example, when processing unreliable source of data, user can rely on this to detect attempts to process items which were already processed in the past.

How to repeat:
Currently, this is thrown: 

    Duplicate entry '<93288773.13-7-2012-4-08-04.RTMail@foobar.com>' for key 'srcId'

Suggested fix:
I suggest to create a subclass,

MySQLDuplicateConstraintViolationException extends MySQLIntegrityConstraintViolationException

to allow users easily diferentiate this case.
[16 Jul 2012 4:04] Valeriy Kravchuk
Thank you for the feature request.