• 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

Extremely Risky transaction attribute

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
In HFEJ P 497. Sharpen your pencil, the question and solution is as follows

4.Of the six transaction attributes, three of them can be dangerous, with
one in particular being EXTREMELY risky. Keeping in mind that the
Bean Provider is NOT the one who specifies the attributes for the bean�s
methods, which of the six is potentially the most dangerous?
Ans:
Mandatory and NotSupported are dangerous, because they throw exceptions, but Supports is the riskiest.... because it means at runtime you don�t know whether it will run in a transaction or not.

My question, I thought that Mandatory and Never throw Exceptions,How is NOT SUPPORTED dangerous, it just suspends the exiting (if there is one) TX and runs in an unspecified Tx ctx.

Please Help,
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai Nileesha

In case of Mandatory and never we get SystemExceptions depending on the callers Tx.These are consider to be dangerous as it is difficult for the client to recover from system exceptions.But support is riskiest as we cannot determine whether it runs in a transaction or not.

Coming to Not supported we cleary know that it always runs without a tx context irrespective of callers Tx,and u cannot consider suspending of callers transaction as dangerous as it too happens for RequiresNew.And for me running in an unspecified Tx context does not seem to be dangerous.
Though it seems to be little confusing u may get clarified when u read it twice or thrice

srinija
SCJP 1.4,SCWCD 1.4
 
Nileesha Bojjawar
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
So you agree that the answer which states that notsupported throws an exception could be a print mistake.
I got the answer from the Solutions for HFEJB Sharpern your Pencil C.pdf

Thanks for confirming!!
 
srinija kosaraju
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Nileesha

does it say the not supported throws an exception.I couldn't get what u have said

srinija
 
Nileesha Bojjawar
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah this what it says:
Mandatory and NotSupported are dangerous, because they throw exceptions
That confused me !!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic