Hi, In the create method of an entity bean, i can throw a custom application exception when, for example, a validation error occurs. That is a "good thing", because the fact that the create method in the home interface throws a "ValidationException" reminds application programmers that use this bean that they have to catch and handle validation exceptions.
Good software always shows symmetry. However, the an entity bean's remove method can only throw RemoveException (or derived exceptions of course). There is no way i can extend the remove method to throw a custom application exception (like my own "ValidationException"). I think of a few solutions, but i dislike them all: 1) let the remove throw an application exception derived from RemoveException => application programmer might forget to catch and handle the validation exception, because it is not explicit in the interface (of course he _has_ to catch the RemoveException, but he might not notice that there is a validation exception 'inside') 2) split the remove and put the validation in a "pre-remove" method, that must be called by the application programmer before calling the real remove => no guarantee that the pre-remove is always called before the actual remove 3) session facade: calls remove and catches and handles the validation exception => (a) i don't want session facades (b) no guarantee that the ejb remove is not called directly I would think more people might have encountered this issue ;-) Any ideas, suggestions? Cheers, Pete
