Page 1 of 1

About Question enthuware.oce-jpad.v6.2.394 :

Posted: Sat Oct 06, 2012 11:48 am
by heaven
Hi,
I believe the explanation is confusing (or misunderstood by me).
As far as I understand, discarding instances only happens if their method throws an exception (that is not an application exception).
In this case 'The bean A instance will be discarded' will only be true if mA() throws the javax.ejb.EJBTransactionRequiredException. If there would be a catch inside the mA() for that exception and the exception would not be propagated further, bean A instance will not be discarded. So 'gettting' an exception is not enough for an instance to be discarded.

Similar situation is at question 381, where I believe the answer 'The A instance will NOT be discarded' should be true. If the bean A will not throw the exception, it will not be discarded (or the explanation should be changed, because receiving an exception is not enough for discarding the instance). In this question 'encounters' should be replaced with 'throws' in assignment.

(Sorry for not putting the 381 question to its own topic, but I wanted to have it on one place as I think they are related)

Re: About Question enthuware.oce-jpad.v6.2.394 :

Posted: Sun Oct 07, 2012 10:41 am
by admin
You are right. The option has now modified to make it clear that Bean A instance will be discard only if there is no exception handling code for the call to mB(). The explanation has also been modified accordingly.

thank you for your feedback!

Re: About Question enthuware.oce-jpad.v6.2.394 :

Posted: Sun Feb 03, 2013 12:01 pm
by Tony_Lang
javax.transaction.TransactionRequiredException is thrown only to remote clients. For local clients, javax.ejb.EJBTransactionRequiredException is thrown.
:?:

But on the javaDoc:
http://docs.oracle.com/javaee/6/api/jav ... ption.html

It is specified that
This exception is thrown to a remote client to indicate that a request carried a null transaction context, but the target object requires an active transaction.
I think TransactionRequiredLocalException is for local:
http://docs.oracle.com/javaee/6/api/jav ... ption.html

EJBTransactionRequiredException for container managed remote

and

javax.transaction.TransactionRequiredException for rmi remote

Thanks

Re: About Question enthuware.oce-jpad.v6.2.394 :

Posted: Wed Dec 17, 2014 5:34 pm
by bluster
Not really the heart of the question, but can you comment on Tony_Lang's post above. The javaDoc he quotes and links seems to contradict that "avax.ejb.EJBTransactionRequiredException" will be thrown, since the API says the exception is thrown to remote clients and blue answer #1 says it is thrown to local clients.

Re: About Question enthuware.oce-jpad.v6.2.394 :

Posted: Wed Dec 17, 2014 7:54 pm
by admin
He is right. Fixed.

thank you for your feedback!
Paul.