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

Moderator: admin

deadlock_gr
Posts: 54
Joined: Tue Apr 19, 2011 10:32 am
Contact:

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

Post by deadlock_gr » Wed May 04, 2011 3:02 pm

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.

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

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

Post by admin » Sat May 07, 2011 8:22 am

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.
If you like our products and services, please help us by posting your review here.

deadlock_gr
Posts: 54
Joined: Tue Apr 19, 2011 10:32 am
Contact:

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

Post by deadlock_gr » Sun May 08, 2011 2:29 pm

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.

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

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

Post by admin » Sun May 08, 2011 2:53 pm

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.

goetz

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

Post by goetz » Sun Jan 15, 2012 8:20 am

FYI, I was confused the same way as deadlock_gr, and didn't think I could assume XBean has the default REQUIRED transaction attribute.

Alan

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

Post by Alan » Sun Mar 25, 2012 11:04 am

why 'If the client does not have a transaction context, only one transaction context will be used.' is wrong?

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

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

Post by admin » Sun Mar 25, 2012 8:12 pm

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.
If you like our products and services, please help us by posting your review here.

Frits Walraven

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

Post by Frits Walraven » Tue Jul 24, 2012 2:39 am

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

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

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

Post by admin » Tue Jul 24, 2012 8:57 pm

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.
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.412 :

Post by sanju.ait@gmail.com » Sat Aug 17, 2013 2:53 pm

"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.

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

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

Post by admin » Sat Aug 17, 2013 6:19 pm

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.
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.

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

ssoltanid
Posts: 3
Joined: Wed Nov 12, 2014 3:03 pm
Contact:

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

Post by ssoltanid » Wed Nov 12, 2014 3:07 pm

I read this topic and the answer to the question.
could be asked This kind of question at the exam ?

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

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

Post by admin » Thu Nov 13, 2014 8:11 pm

Yes, it is possible.
If you like our products and services, please help us by posting your review here.

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

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

Post by renatumb » Thu Jan 29, 2015 1:33 pm

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.
Just a complement:
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!

himaiMinh
Posts: 358
Joined: Fri Nov 29, 2013 8:26 pm
Contact:

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

Post by himaiMinh » Tue Apr 28, 2015 2:56 pm

If the client does not have a transaction context ...
There are two scenarios:
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.

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

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

Post by admin » Tue Apr 28, 2015 8:06 pm

"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.

aazizi.tarik
Posts: 31
Joined: Sun Dec 27, 2015 1:47 pm
Contact:

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

Post by aazizi.tarik » Fri Jan 08, 2016 3:22 pm

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

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

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

Post by admin » Sun Jan 10, 2016 8:44 am

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.

aazizi.tarik
Posts: 31
Joined: Sun Dec 27, 2015 1:47 pm
Contact:

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

Post by aazizi.tarik » Sun Jan 10, 2016 8:46 am

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

johnlong
Posts: 185
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

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

Post by johnlong » Mon May 29, 2017 11:49 pm

a new one is created for YBean also.
Where exactly does this new transaction demarcation start : in XBean.regularM() or in YBean.AsyncM?

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

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

Post by admin » Mon May 29, 2017 11:56 pm

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.

johnlong
Posts: 185
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

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

Post by johnlong » Tue May 30, 2017 11:08 am

I see, will this transaction cover any application code in this particular example?

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

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

Post by admin » Tue May 30, 2017 11:51 am

Yes, it will cover asycnM method.
If you like our products and services, please help us by posting your review here.

johnlong
Posts: 185
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

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

Post by johnlong » Thu Jun 01, 2017 7:43 am

So transactional context will propagate into asycnM method and it will be new transaction as if RequiresNew transactional attribute specified on asyncM method?

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

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

Post by admin » Thu Jun 01, 2017 8:56 am

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest