MZ Study notes and most probably HF book (not remember which page exactly) say that Container must throw IllegalStateException if getRollbackOnly() is invoked from a business method executing with Supports, NotSupported, Never attributes. I understand why this behavior with NotSupported and Never attributes but then why with Supports? With Supports, it is possible that a business method is invoked with a trans context because the trans context is passed on with Supports. Am I correct? Please reply.
With Supports, it is also possible that the method is invoked in an unspecified transaction context. Assuming that the method calls getRollbackOnly() and that it is invoked in unspecified transaction, then its a problem.
Agreed that if method with Supports attribute is called with unspecified trans context then container will throw IllegalStateException. But what if the method is invoked with a trans context, then will it still throw the same exception (at least that's what I can infer from the MZ Study Guide)
In my opinion the container will only throw the IllegalStateException when the getRollbackOnly() or setRollbackOnly() are called without a meaningful transaction context. At least this is what the spec says. This means that if you are using Supports attribute and the method is running in a meaningful transaction context everything should be ok because the Tx context exists and the container can perform the get/setRollbackOnly() methods. Otherwise, the container will throw an IllegalStateException.
SCJP 1.4, SCBCD 1.3<br />IBM 141, 484, 486
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop