About Question enthuware.oce-ejbd.v6.2.525 :
Moderator: admin
About Question enthuware.oce-ejbd.v6.2.525 :
Hi,
Can you please explain why option 1 is not valid?
Thanks!
Can you please explain why option 1 is not valid?
Thanks!
-
- Site Admin
- Posts: 10102
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.525 :
Because rolling back a transaction does not cause the destruction of a session bean. That is as per the specification.
HTH,
Paul.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
Re: About Question enthuware.oce-ejbd.v6.2.525 :
But In case of a system exception, the transaction is rolled back and the bean is discarded, right?
-
- Site Admin
- Posts: 10102
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.525 :
Yes, so the reason for destruction is the system exception, not the rollback of the transaction. Therefore, it cannot be said that if you rollback the transaction, the bean will be destroyed.
HTH,
Paul.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 38
- Joined: Fri Aug 16, 2013 11:37 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.525 :
"when a bean method throws a non-application exception." is also wrong I guess.
Reason : When method throes checked non application exceptions like IOException, bean won't be destroyed.
Reason : When method throes checked non application exceptions like IOException, bean won't be destroyed.
-
- Site Admin
- Posts: 10102
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.525 :
Can you please specify where did you see that because I don't see that in the specification.sanju.ait@gmail.com wrote:"when a bean method throws a non-application exception." is also wrong I guess.
Reason : When method throes checked non application exceptions like IOException, bean won't be destroyed.
-Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 38
- Joined: Fri Aug 16, 2013 11:37 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.525 :
As mentioned by you, @ApplicationException is not required for an exception to be an application exception if the exception is a checked exception.
So applying that logic here, IOException won't destroy the bean.
So applying that logic here, IOException won't destroy the bean.
-
- Site Admin
- Posts: 10102
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.525 :
I am sorry but have no idea what you are trying to say. Where is IOException coming into picture in this question.sanju.ait@gmail.com wrote:As mentioned by you, @ApplicationException is not required for an exception to be an application exception if the exception is a checked exception.
So applying that logic here, IOException won't destroy the bean.
You wrote,
And I explained to you that your argument is not correct. A bean is destroyed when a non-application exception is thrown. That is why option 2 is correct."when a bean method throws a non-application exception." is also wrong I guess.
IOException is an Application Exception, so the bean will not be destroyed. But the option that you are talking about is saying something else.
If you like our products and services, please help us by posting your review here.
-
- Posts: 197
- Joined: Mon Jun 20, 2016 5:06 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.525 :
If @Remove(retainIfException=false) is used, the bean is destroyed even if the @Remove method throws an exception.
I have two questions about this situation.
First, If remove method throws exception an as in described above, @PreDestroy won't be called, correct?
Second, can we say that invoking @Remove method will always destroy session bean?
I have two questions about this situation.
First, If remove method throws exception an as in described above, @PreDestroy won't be called, correct?
Second, can we say that invoking @Remove method will always destroy session bean?
-
- Site Admin
- Posts: 10102
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.525 :
1. No, if the bean is removed then @PreDestroy will be called. The rule is if the @Remove annotation specifies the value of retainIfException as true, and the Remove method throws an application exception, the instance is not removed and the PreDestroy lifecycle callback interceptor methods are not invoked.
2. No, as mentioned above, it will not be removed if @PreDestroy throws an application exception and retainIfException is true.
2. No, as mentioned above, it will not be removed if @PreDestroy throws an application exception and retainIfException is true.
If you like our products and services, please help us by posting your review here.
-
- Posts: 197
- Joined: Mon Jun 20, 2016 5:06 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.525 :
Then invoking @Remove(retainIfException=false) method with will always destroy session bean?
-
- Site Admin
- Posts: 10102
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.525 :
Yes, that is correct.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 9 guests