About Question enthuware.oce-ejbd.v6.2.412 :
Moderator: admin
-
- Posts: 54
- Joined: Tue Apr 19, 2011 10:32 am
- Contact:
About Question enthuware.oce-ejbd.v6.2.412 :
The class definition should be visible for XBean to show that no TransactionalAttribute is specified. We can't just assume that REQUIRED is implied since we can't see the class definition.
-
- Site Admin
- Posts: 10079
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.412 :
Hello,
REQUIRED is the default so even if you don't see it, you should assume it as REQUIRED. This is also noted in the explanation for option 3.
HTH,
Paul.
REQUIRED is the default so even if you don't see it, you should assume it as REQUIRED. This is also noted in the explanation for option 3.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 54
- Joined: Tue Apr 19, 2011 10:32 am
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.412 :
Even though, we can't see the class definition to see that no other value has been specified. If we could see the class definition, to see that REQUIRED has not been overridden, we are in no position to be sure that it hasn't.
-
- Site Admin
- Posts: 10079
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.412 :
The question also clearly says, "In absense of any other deployment information related to these beans, ...". So I don't think there is any scope to infer that the transaction attribute has been overridden.
If you like our products and services, please help us by posting your review here.
Re: About Question enthuware.oce-ejbd.v6.2.412 :
FYI, I was confused the same way as deadlock_gr, and didn't think I could assume XBean has the default REQUIRED transaction attribute.
Re: About Question enthuware.oce-ejbd.v6.2.412 :
why 'If the client does not have a transaction context, only one transaction context will be used.' is wrong?
-
- Site Admin
- Posts: 10079
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.412 :
Because as option 3 explains, "Since by default the transaction context of a bean is REQUIRED, there will be one transaction context for XBean (either the client's txn context will be used or a new one will be created for XBean) and since the transaction context is never propagated to an asynchronous invocation, a new one is created for YBean also. "
So there will be two transaction contexts created even if the client doesn't have any transaction context.
HTH,
Paul.
So there will be two transaction contexts created even if the client doesn't have any transaction context.
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.412 :
I think there is a @Stateless missing (and the class def.) on the XBean.java, because the question states:
"Consider the following code for two stateless beans" and
"In absense of any other deployment information"
Regards,
Frits Walraven
"Consider the following code for two stateless beans" and
"In absense of any other deployment information"
Regards,
Frits Walraven
-
- Site Admin
- Posts: 10079
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.412 :
The fact that XBean is stateless is already given in the question. The question also says in absence of any other deployment information (and not "in absence of any deployment information in the bean"). So I think a complete class definition for XBean is not required for the purpose of this question.
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.412 :
"If the client does not have a transaction context, only one transaction context will be used."
This seems to be a better option compared to assuming XBean is already in transaction by default.
This seems to be a better option compared to assuming XBean is already in transaction by default.
-
- Site Admin
- Posts: 10079
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.412 :
Did you read the explanation for option 3? It explains exactly why 2 transactions will be created whether the client has a transaction or not.sanju.ait@gmail.com wrote:"If the client does not have a transaction context, only one transaction context will be used."
This seems to be a better option compared to assuming XBean is already in transaction by default.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 3
- Joined: Wed Nov 12, 2014 3:03 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.412 :
I read this topic and the answer to the question.
could be asked This kind of question at the exam ?
could be asked This kind of question at the exam ?
-
- Site Admin
- Posts: 10079
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.412 :
Yes, it is possible.
If you like our products and services, please help us by posting your review here.
-
- Posts: 47
- Joined: Mon Apr 08, 2013 7:55 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.412 :
Just a complement:admin wrote:Hello,
REQUIRED is the default so even if you don't see it, you should assume it as REQUIRED. This is also noted in the explanation for option 3.
HTH,
Paul.
YBean is annotated with REQUIRED, even without this annotation it would run in a transaction context.. As Paul had said:
".. if you don't see it, you should assume it as REQUIRED" ... so, 2 transactions context will be used!
-
- Posts: 358
- Joined: Fri Nov 29, 2013 8:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.412 :
There are two scenarios:If the client does not have a transaction context ...
1. The client of XBean does not have a transaction context. But XBean 's regularM () is executed in a transaction by default. YBean's asyncM() executes in its own separate transaction. Therefore, there are only 2 transaction contexts, one is for regularM(), another one is for asyncM()
2. The client refers to XBean, maybe ? If XBean's regularM() has a transaction attribute NotSuppported, then, there is only one transaction context for asyncM().
In my opinion, we need to clarify who the client this option is refering to.
-
- Site Admin
- Posts: 10079
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.412 :
"If XBean's regularM() has a transaction attribute NotSuppported" cannot happen because the question clearly says< "In absence of any other deployment information or annotations related to these beans". Where there is no such information, then the transaction attributed is assumed to be Required.
If you like our products and services, please help us by posting your review here.
-
- Posts: 31
- Joined: Sun Dec 27, 2015 1:47 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.412 :
This "In absence of any other deployment information or annotations related to these beans" doesn't mean that the bean is not a BMT, in that case there will be only one Tx context I guess
-
- Site Admin
- Posts: 10079
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.412 :
As per section 13.3.1:
Typically enterprise beans will be specified to have container-managed transaction demarcation. This is the default if no transaction management type is specified.
If you like our products and services, please help us by posting your review here.
-
- Posts: 31
- Joined: Sun Dec 27, 2015 1:47 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.412 :
Ok, I thought "absence of any other deployment information or annotations" means that some annotation exist and we don't have the information. sorry its my english wich is bad
-
- Posts: 197
- Joined: Mon Jun 20, 2016 5:06 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.412 :
Where exactly does this new transaction demarcation start : in XBean.regularM() or in YBean.AsyncM?a new one is created for YBean also.
-
- Site Admin
- Posts: 10079
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.412 :
The container starts a new one just before it invokes YBean.AsyncM method. It happens in container's code. Not in application code.
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.412 :
I see, will this transaction cover any application code in this particular example?
-
- Site Admin
- Posts: 10079
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.412 :
Yes, it will cover asycnM method.
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.412 :
So transactional context will propagate into asycnM method and it will be new transaction as if RequiresNew transactional attribute specified on asyncM method?
-
- Site Admin
- Posts: 10079
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.412 :
Yes, REQUIRED behaves like REQUIRES_NEW in case of asynchronous calls.
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 3 guests