Closed chengfang closed 4 years ago
As per specification, Section 9.3.6 EJBTransactionRolledbackException
should be thrown if instance is part of client's transaction, otherwise for a remote client jakarta.transaction.TransactionRolledbackException
is thrown and for a local client jakarta.ejb.TransactionRolledbackLocalException
is thrown.
@hussainnm the spec section you quoted supports the claim of this issue, that is, EJBTransactionRolledbackException
is intended for both remote and local invocations of ejb business methods, and therefore, its javadoc needs to be updated to reflect that. I suspect the javadoc description was an oversight.
My understanding is when the EJBTransactionRolledbackException
and TransactionRolledbackLocalException
were introduced in 2.0, one was meant for remote client and the other was meant for local client. EJBTransactionRolledbackException
should be thrown if and only if the business interface does not extend java.rmi.Remote
in remote client otherwise it should throw jakarta.transaction.TransactionRolledbackException
.
This is how I understand it:
EJB 2.x:
remote client: jakarta.transaction.TransactionRolledbackException
local client: jakarta.ejb.TransactionRolledbackLocalException
EJB 3:
any client (both local and remote) of ejb that does not extend java.rmi.Remote
(that is 99.9% of case): EJBTransactionRolledbackException
. This is the focus of this issue. Any remote ejb3 beans that extend java.rmi.Remote
is rare case and for practical purpose, we can just ignore it.
Ok, got it.
Hey @chengfang I think we are good with this issue now. Can we close?
The fix has been merged and this issue is resolved.
EJBTransactionRolledbackException class description states:
But this exception can be thrown to both remote and local client of ejb business methods. So we may need to remove the word "remote", and probably replace it with something like "is thrown to a caller of bean business method to indicate ..."