Dan OConnor wrote:
> On 12 Apr 00, at 11:13, Richard Monson-Haefel wrote:
> > >
> > > This depends on how you want RemoteException thrown by
> other beans to be handled.
> > > Transactions in EJB 1.1 are always rollback in the event of a
> EJBException is thrown
> > > but not always for RemoteException. As David pointed out,
> you can choose to propagate
> > > the RemoteException thrown by another bean to the client.
>
> On 12 Apr 00, at 13:54, Richard Monson-Haefel wrote:
>
> > RemoteExceptions thrown by beans do not always denote a "system failure", but can
>be thrown
> > to indicate a transaction rollback as well, which may OR may not be recoverable.
>For
> > Example: If bean 'A' invokes a method on bean 'B' AND bean 'B' executes the method
>in its
> > own independent transaction context, a failure by bean 'B' will result in a
>RemoteException
> > being thrown to bean 'A'. In this case, bean 'A' transaction is not affected by
>the bean
> > 'B''s exception. If its an entity bean or stateless session bean, bean 'A' can
>try the
> > operation again (possibly with different parameters). If it fails a second time
>then bean
> > 'A' should probably throw its own EJBException.
>
> Hi Richard,
>
> I appreciate your response, which I think does a good job of
> explaining many of the issues involved in EJB exception handling.
> Sorry to keep after this, but I'm still not sure that there is any
> difference between throwing a RemoteException and an
> EJBException, even after your explanation. Could I take one more
> try at explaining my reading of the specification?
>
> It is certainly true that a client executing in a transaction that
> receives a RemoteException may not have that transaction rolled
> back. The remote method call may never have even reached the
> server because of a communication error, for instance. So your
> point that bean 'A' can retry bean 'B' after receiving a
> RemoteException is certainly true. And if bean 'B' executes in its
> own transaction context, of course its failure won't necessarily
> mean that 'A''s transaction is rolled back.
>
> But in the case of a bean throwing RemoteException, rather than a
> client receiving a RemoteException, I think that the current
> transaction will be marked for rollback and the instance will be
> discarded, exactly as if an EJBException had been thrown. You
> seemed to be saying that there was a difference when throwing
> these transactions from a bean: "Transactions in EJB 1.1 are
> always rollback in the event of a EJBException is thrown but not
> always for RemoteException."
>
My mistake. Scratch that statement. You are right, of course, that the
RemoteException will
always thrown by a bean method will always cause the container rollback or mark for
rollback the
transaction context of the method. Its treated just like an EJBException or any other
RuntimeException by the container.
However, a RemoteException thrown by bean 'B' doesn't automatically cause bean 'A'
transaction to
be marked for rollback. I depends on whether bean 'B' executed in the context of bean
'A''s
transaction. I think you understand that, but I thought it was worth repeating.
Thanks for catching that,
Richard
--
Richard Monson-Haefel
Author of Enterprise JavaBeans, 2nd Edition
Published by O'Reilly & Associates
http://www.EjbNow.com
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".