Hello Rickard,
Monday, July 24, 2000, 3:26:57 PM, you wrote:
R�> Hi!
R�> Stephan Gruschke wrote:
>> Oh, yeap. The problem is that if an exception occurs in an bmp entity
>> bean, an InvocationTargetException is thrown. The exception is an
>> wrapper for the real exception thrown by the bean. What should be the
>> preferred way: Wrap the returned bean exception in an create exception
>> or return the real exception?
R�> As it says in the EJB spec is the preferred way ;-) (i.e. go look it up)
Well the ejb spec states that the original exception should be thrown.
That's clear. But the problem is *who* should throw the original exception?
BMPPersistenceManager or some module higher responsible for the
invocation of the client?
The idea was sending back the Create- or the InvocationTargetException
and letting some higher module (for example EntityContainer?) the
responsibility to send the real exception. This would decrease the
amount of different exception types thrown inside of an entity bean call
and would result in some easier handling of different exceptions,
wouldn't it?
Another point would be distinguishing between exception thrown by the
bean and by the container. An bean could throw an InvocationTargetException
and it would be impossible for high-level modules to determine if the
exception was thrown by the container or the bean. If the bean
exception would be wrapped by some well defined exceptions inside
the container the interface to other modules would be more precise.
stephan.