• 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
  • Liutauras Vilda
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Peter Rooke
  • Himai Minh
Bartenders:
  • Piet Souris
  • Mikalai Zaikin

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.

 
Who among you feels worthy enough to be my best friend? Test 1 is to read this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic