jakartaee / enterprise-beans

Jakarta Enterprise Beans
https://eclipse.org/ee4j/ejb
Other
20 stars 29 forks source link

Incorrect description in javadoc of EJBTransactionRolledbackException #116

Closed chengfang closed 4 years ago

chengfang commented 4 years ago

EJBTransactionRolledbackException class description states:

This exception is thrown to a remote client to indicate that the transaction associated with processing of the request has been rolled back, or marked to roll back.

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 ..."

hussainnm commented 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.

chengfang commented 4 years ago

@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.

hussainnm commented 4 years ago

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.

chengfang commented 4 years ago

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.

hussainnm commented 4 years ago

Ok, got it.

jeanouii commented 4 years ago

Hey @chengfang I think we are good with this issue now. Can we close?

chengfang commented 4 years ago

The fix has been merged and this issue is resolved.