aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Doubt in JavaBeat question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Doubt in JavaBeat question" Watch "Doubt in JavaBeat question" New topic
Author

Doubt in JavaBeat question

krishna bulusu
Ranch Hand

Joined: Aug 28, 2006
Posts: 185
Hi Following is the question from Javabeat:

Which of the following transaction attribute instructs the Container that the
business method defined within an enterprise bean should be executed within an
active transaction?
a. MANDATORY
b. REQUIRED
c. NEVER
d. None of the above.

The correct Answer is:a
But my answer is a&b
Please explain whether I am correct or not.


Thanks&Regards, Krishna.
SCJP1.4, SCWCD1.4, SCBCD 5.0
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9427
    
    2

Option A enforces Transaction but option B does not.


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Sergio Tridente
Ranch Hand

Joined: Mar 22, 2007
Posts: 329

Just to clarify.

When the transaction attribute is MANDATORY, the business method needs to be called with an existing transaction context, e.g. it cannot be called with an unspecified transaction context (aka no transaction context).

When the transaction attribute is REQUIRED, the business method may be called with no transaction context or with an existing transaction context. In the first case (no transaction context), the Container will create a new transaction for the method to run in. In the second one, it will use the client's transaction (by client I mean a client to the bean's business method; it can be a real client application or another bean).


SCJP 1.4 (88%) - SCJP 5.0 Upgrade (93%) - SCWCD 1.4 (97%) - SCBCD 5.0 (98%)
krishna bulusu
Ranch Hand

Joined: Aug 28, 2006
Posts: 185
The above question is not for the client. It is for the Bean's business method.
Which attributes tell the container that the business method should be executed in a transaction context?
1)MANDATORY-> Obvious. Name itself is telling that.
2)REQUIRED-> Name itself is telling that Transaction context is REQUIRED for the Method.
So, the Answer should be above two.
Please let me where I am going wrong.
Satya Maheshwari
Ranch Hand

Joined: Jan 01, 2007
Posts: 368
Which of the following transaction attribute instructs the Container that the business method defined within an enterprise bean should be executed within an active transaction?


Here the keyword is within. A method with REQUIRED transaction context can be called even when its not within. a transaction context but for MANDATORY, its requred to be called within a transaction.

I guess this question is a bit ambiguous and has to do more with grammar


Thanks and Regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in JavaBeat question