About Question enthuware.oce-ejbd.v6.2.485 :

Moderator: admin

Post Reply
Guest

Re: About Question enthuware.oce-ejbd.v6.2.485 :

Post by Guest »

first i was only thinking about the x==0 part, where it is not specified which param value the method is called with and i guess you where about to write true instead.

now i also think that you should specify that this ia about a local bean, if im not wrong only local beans throw EJBTransactionRolledbackException while remote beans throw TransactionRolledbackException???

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.485 :

Post by admin »

You are right, the question needs to specify that x = 0.

It is not necessary to specify that it is a local bean because javax.transaction.TransactionRolledbackException is not in any of the options and "None of these" is also not among the options. Further, javax.transaction.TransactionRolledbackException is thrown only if the remote interface extends java.rmi.Remote, which is a special case because, since EJB 3.x, implementing java.rmi.Remote has been out of practice.
If you like our products and services, please help us by posting your review here.

renatumb
Posts: 47
Joined: Mon Apr 08, 2013 7:55 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.485 :

Post by renatumb »

How about

"The transaction may or may not be rolled back depending on values in deployment descriptor or annotations."

If the exception is a System Exception but its descriptor has a <application-exception> so it will become a Aplication Exception, also if its descriptor has a <rollback>false</rollback>, the transaction will not be rolled back.

Therefore 5th option may be correct too, or not ?

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.485 :

Post by admin »

No, because the code shows that it throws EJBException and not some other exception that might be annotated with anything.
If you like our products and services, please help us by posting your review here.

amaebi
Posts: 4
Joined: Wed Jul 02, 2014 2:00 am
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.485 :

Post by amaebi »

Will bean1 also be discarded in addition to bean 2 being discarded?

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.485 :

Post by admin »

No, based on the given information, it cannot be said that bean1 will be or will not be discarded.
If you like our products and services, please help us by posting your review here.

amaebi
Posts: 4
Joined: Wed Jul 02, 2014 2:00 am
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.485 :

Post by amaebi »

Thanks for the reply. What would prevent bean1 from being discarded since bean1 receives javax.ejb.EJBTransactionRolledbackException because of the call to do2() of Bean2 running within the same transaction and getting an exception.

Similarly to enthuware.oce-ejbd.v6.2.526, "The bean A instance will NOT be discarded" is not a valid answer choice because of explanation "[bean A] will receive a javax.ejb.EJBTransactionRolledbackException which is a system exception because it extends from EJBException. Therefore, the bean instance will be discarded."

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.485 :

Post by admin »

If a bean performs an operation that results in a system exception and if that exception is not handled by the bean and is thrown out to the container, then the bean is discarded.

If a bean A calls another bean B and if the bean B's method throws a system exception, bean B will definitely be discarded but if bean A has the method call in a try/catch block that handles the system exception, there is no reason for bean A to be discarded. But if A's code doesn't catch the exception then that exception will go to the container and then bean A will be discarded as well.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests