Vlada Matena wrote:
> ----- Original Message -----
> From: Richard Monson-Haefel <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, December 14, 1999 7:54 AM
> Subject: EJB 1.1: AppExceptions and Tx
>
> > EJB 1.1 Exception Handling section its specifies that that an
> > application exception thrown from a container initiated transaction (one
> > that starts with the bean invocation) may or may not indicate a
> > transaction rollback. This seems flawed to me. The bean should be
> > required to throw a system exception (possibly wrapping a application
> > exception) if a transaction roll back is forced
> > (EJBContext.rollbackOnly()). Also the container should throw a
> > RemoteExcepton if the bean explicitly rolls back the transaction or if
> > the container fails to commit the transaction after receiving an App
> > Exception.
> >
> > As it stands now, an application exception thrown by a bean that started
> > its own transaction (Required, Required New) may or may not indicate
> > that the transaction was rolled back. Since there is no way to check on
> > the success of the transaction from the bean's client, their is no way
>
> If the client gets an application exception, it knows that the bean's transaction
> was not rolled back at the end of the method. If the client runs in the same
> transaction as the bean that threw the exception, the client's transaction
> might have been marked for rollback by the bean. The client can find out
> by inquiring about the transaction status.
>
This is not how the specification is worded. Referring to Table 8 of the Public
Release 2, in the third row where the scope of the transaction is delimited by the
bean method and its an application exception type:
The bean can choose to invoke setRollbackOnly() before throwing an Application
Exception. If this occurs, the spec says that the container must re-throw the
application exception. So the client can *not* know the disposition of the bean's
transaction. The bean should be required to throw a system exception if it chooses to
invoke setRollbackOnly( ) otherwise there is absolutely now way for the client to
determine if the transaction was successful or not.
--
Richard Monson-Haefel
EJB Expert for jGuru.com
( http://www.jguru.com )
Author of Enterprise JavaBeans
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".