openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Defoy" <>
Subject Detection of constraint violations
Date Tue, 21 Aug 2007 18:19:43 GMT

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!


View raw message