There is actually (what I think is) a very elegant and simple solution
to the issue you bring up. What we do to to explicitly define our
constraints (we never use the schema generation stuff), which gives
you the ability to name the constraint. Then, when an exception does
occur we (using the Spring framework) convert the jdbc exception to
spring's DataAccessException. If the exception happens to be
something like a constraint violation, we then parse the name of the
contraint violated and use the name in a resource bundle lookup for
display to the end user. Can't get much more user friendly than that;
and I don't have to jump through any more hoops than necessary to do
this vaidation thing. |