Aatir, I think the book's answer is correct. Because as for ejbActivate(), ejbPassivate(), setEntityContext(), whithin this three methods there's no valid Tranaction context. Please take a look spec Page 80 (for stateful Session Bean), Page 180 (for Entity Bean), since no valid tx ctx within these methods, of course 4, 5, 6 are wrong, while in the 1, 2, 3 methods, valid tx ctx are there. since MessageDriven Bean and stateless bean has no ejbActivate(), ejbPassivate(), so we don't need to concern this two types of bean here.
in spec page 79, it says "The ejbRemove() method cannot be called when the instance is participating in a transaction. An attempt to remove a session object while the object is still in a transaction will cause the container to throw the javax.ejb.RemoveExcetption to the client."
The original question was: Which method(s) run in the transaction context of the method that causes their invocation?
(maybe i understand question wrong?)
**hmm.. or is it talking about Entity beans only [ August 01, 2004: Message edited by: Ryan Wong ]