I suspect that the being method being called is the one declared in the javax.transaction.UserTransaction interface. If this is the case, then A and C can be eliminated because CMT beans cannot use the UserTransaction interface. Then since we are talking about stateless session beans, only answer D makes sense as BMT session beans can only use the UserTransaction interface in their business methods and not in their ejbRemove method. (Table 3, page 90 of the spec)
Note: if we were talking about stateful session beans, the story would be different as answers B and D would be both correct (Table 2, page 80 of the spec)
It seems that this is the only place where the rule for look up UserTransaction is 'decoupled' from calling UserTransaction methods.
The same happens in ebjCreate/Remove of MDB. I find this annoying too, I don't understand why you are able to look it up if you can't use it. Does anyone know what the story is here? I have the feeling it's one of those the-spec-says-so things ...
This is one of the questions in the sun practice exams. It says answer is D, which makes sense. Even though you have the sessionContext reference, only you can call non-transaction related methods. Since they all throw IllegalStateException when called in a non tx method and all the SessionBean interface run in unspecified Tx, it can only be business method in BMT.
A magnificient life is loaded with tough challenges. En garde tiny ad: