Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Extremely Risky transaction attribute

 
Nileesha Bojjawar
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • 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,
 
srinija kosaraju
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
Yeah this what it says:
Mandatory and NotSupported are dangerous, because they throw exceptions
That confused me !!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic