Forums Register Login

Extremely Risky transaction attribute

+Pie Number of slices to send: Send
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,
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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!!
+Pie Number of slices to send: Send
hi Nileesha

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

srinija
+Pie Number of slices to send: Send
Yeah this what it says:
Mandatory and NotSupported are dangerous, because they throw exceptions
That confused me !!
Barry's not gonna like this. Barry's not gonna like this one bit. What is Barry's deal with tiny ads?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 661 times.
Similar Threads
HF EJB "Sharpen your pencil p. 497"
Transaction from HF Page 497
Transaction questions
some confusion
HFEJB-497 Page- 4th qs
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 22:49:06.