• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Doubt in JavaBeat question

 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Option A enforces Transaction but option B does not.
 
Ranch Hand
Posts: 329
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
krishna bulusu
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic