1Z0-895 · Question #3
Given the following stateless session bean implementation classes: Assuming no other transaction-related metadata, what are the transaction attributes of methodA, methodB, and methodC respectively?
The correct answer is C. MANDATORY, MANDATORY , and REQUIRES_NEW. You can only bring out the effects of transaction attributes only when you call the method through a session bean instance and NOT through a direct method call. Even if your methods are within the same bean, you need to get the local instance of the same bean and call through…
Question
Exhibit
Options
- AMANDATORY, MANDATORY , and MANDATORY
- BREQUIRED, MANDATORY, and REQUIRES_NEW
- CMANDATORY, MANDATORY , and REQUIRES_NEW
- DREQUIRED, REQUIRES_NEW, and REQUIRES_NEW
How the community answered
(46 responses)- A7% (3)
- B4% (2)
- C76% (35)
- D13% (6)
Explanation
*You can only bring out the effects of transaction attributes only when you call the method through a session bean instance and NOT through a direct method call. Even if your methods are within the same bean, you need to get the local instance of the same bean and call through its local interface instead of a direct method invoke. *The enum TransactionAttributeType is used with the TransactionAttribute annotation to specify whether the methods of a session bean or message driven bean are called with a valid transaction context. If a client invokes the enterprise bean's method while the client is associated with a transaction context, the container invokes the enterprise bean's method in the client's transaction context. The container must invoke an enterprise bean method whose transaction attribute is set to REQUIRES_NEW with a new transaction context. TransactionAttributeType.MANDATORY
Topics
Community Discussion
No community discussion yet for this question.
