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

Moderator: admin

Post Reply
jszczepankiewicz

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

Post by jszczepankiewicz »

I think the first answer may be true. As per 14.3.1, table 15 (at the end). "Bean method runs with an unspecyfied transaction context. This case may happen with the NotSupported, Never, and Supports attributes"..."Client's view receives EJBException. The client receives EJBTransactionRollebBackException but only if the transaction of the caller is present (SUPPORTS). So the answer is wrong for question " A client of a session bean calls a method on the bean and the method throws a system exception. ". The answer will be false if the question would be: "A client of a session bean calls a method on the bean and the method throws a system exception and the caller is in transaction context". Or the first checkbox would have the label: "If the transaction attribute of the method is SUPPORTS and the client is in transaction, the client will get EJBException."

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

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

Post by admin »

I think the given answer is correct because the option implies that the client will always get an EJBException, which, of course, is not true as noted by the explanation.
If you like our products and services, please help us by posting your review here.

sanju.ait@gmail.com
Posts: 38
Joined: Fri Aug 16, 2013 11:37 pm
Contact:

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

Post by sanju.ait@gmail.com »

"If the bean method runs in the context of a transaction that the container started immediately before dispatching the business method, the client will get EJBException." Yes this is true.

But in explanation : "An example of a situation where this could happen is if Bean1 has transaction attribute of REQUIRED and it calls Bean2, which has transaction attribute of REQUIRES_NEW. In this case, Bean1 will get EJBException and its transaction would not be affected even though Bean2's transaction would be rolled back and its instance discarded."

If Bean1 will get System Exception from Bean2, won't this discard the instance of Bean1?

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

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

Post by admin »

Getting a system exception and throwing a system exception are two different things. If a bean gets any exception because of any method call that it is has made, it can always catch it and proceed normally.

It is only when a bean method throws a system exception outside the bean (i.e. to the container), it is destroyed.

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

sanju.ait@gmail.com
Posts: 38
Joined: Fri Aug 16, 2013 11:37 pm
Contact:

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

Post by sanju.ait@gmail.com »

Throwing system exception is the culprit of instance discarding and not catching system exception.
Thanks a lot Paul.

aposoft
Posts: 2
Joined: Thu Jan 30, 2014 4:39 pm
Contact:

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

Post by aposoft »

I think that:
The last option is true too.
If the bean method runs in the context of a transaction that the container started immediately before dispatching the business method, the client will get EJBTransactionRolledbackException.
Explanation:
An example of a situation where this could happen is if Bean1 has transaction attribute of REQUIRED and it calls Bean2, which has transaction attribute of REQUIRED. In this case, Bean1 will get EJBTransactionRolledbackException .

Because as the right answer:
If the bean method runs in the context of a transaction that the container started immediately before dispatching the business method, the client will get EJBException.
Explanation:
An example of a situation where this could happen is if Bean1 has transaction attribute of REQUIRED and it calls Bean2, which has transaction attribute of REQUIRES_NEW. In this case, Bean1 will get EJBException and its transaction would not be affected even though Bean2's transaction would be rolled back and its instance discarded.

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

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

Post by admin »

I am sorry but I am not sure what you mean. Option 5 is not correct because in that case the client will get EJBException (not EJBTransactionRolledbackException ) as explained in option 3.
If you like our products and services, please help us by posting your review here.

aposoft
Posts: 2
Joined: Thu Jan 30, 2014 4:39 pm
Contact:

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

Post by aposoft »

aposoft wrote:I think that:
The last option is true too.
If the bean method runs in the context of a transaction that the container started immediately before dispatching the business method, the client will get EJBTransactionRolledbackException.
Explanation:
An example of a situation where this could happen is if Bean1 has transaction attribute of REQUIRED and it calls Bean2, which has transaction attribute of REQUIRED. In this case, Bean1 will get EJBTransactionRolledbackException .

Because as the right answer:
If the bean method runs in the context of a transaction that the container started immediately before dispatching the business method, the client will get EJBException.
Explanation:
An example of a situation where this could happen is if Bean1 has transaction attribute of REQUIRED and it calls Bean2, which has transaction attribute of REQUIRES_NEW. In this case, Bean1 will get EJBException and its transaction would not be affected even though Bean2's transaction would be rolled back and its instance discarded.
I'm sorry, I was confusing the client's transaction with the transaction started by the container before dispatching the business method.

Post Reply

Who is online

Users browsing this forum: No registered users and 83 guests