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.
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