• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

transaction question.

 
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Foks, pleas help me on the following statement:

"If the client calls with a transaction context, the behavior is similar to REQUERIED" --> "SUPPORTS".

Right, I agree with because it keeps the same transaction and continue running normally.

My question is..why cannot i say that "mandatory" could also be a correct response in this case? Because it also keeps the same transaction and continue running normally!!!

Please advise!!!

Tks in advance! ;-)
 
Steven Colley
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just fixing a typo: *REQUIRED instead of REQUERIED!
 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The difference between SUPPORTS and MANDATORY is that MANDATORY will throw an exception if it is invoked without a Tx context. Take a look at the following fragment from Mikalai Zaikin Notes for SCBCD 5.0:


MANDATORY

The container must invoke an enterprise bean method whose transaction attribute is set to MANDATORY in a client's transaction context. The client is REQUIRED to call with a transaction context.

If the client calls with a transaction context, the container performs the same steps as described in the REQUIRED case.

If the client calls without a transaction context, the container throws the javax.ejb.EJBTransactionRequiredException. If the EJB 2.1 client view is used, the container throws the javax.transaction.TransactionRequiredException exception if the client is a remote client, or the javax.ejb.TransactionRequiredLocalException if the client is a local client.



(The only two Tx types that will throw exception are NEVER and MANDATORY.)

So, you are right, according to MZ notes:


"If the client calls with a transaction context, the behavior is similar to REQUERIED" --> "SUPPORTS" AND MANDATORY.

 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic