Hello,

I am looking for a way of programatically detecting whether an
exception was caused by a constraint violation.  What is the best way
to do that?

The only way I have found so far is to navigate up the cause chain of
the exception and see if one happens to be an SQLException and if so,
get the SQLState and see if it is 23xxx.

Is there a simpler way?

Oh, by the way, example 12.2 of the manual states that we can put
@Unique annotations in the @Table one but it turns out that type must
be @UniqueConstraint.

Thanks in advance!

Christian

Reply via email to