The EJB spec page 90 says that in the ejbCreate() and ejbRemove() methods of a BMT stateless session bean, it is OK to call getUserTransaction() but not to use any UserTransaction methods. Is this correct, and if so what would be the point of doing this? Head First EJB combines the two things together (get the transaction reference and call methods on it), and says (page 228) that these are *not* allowed in ejbCreate() and ejbRemove(). What is *really* allowed in these methods?
For Stateless Session Bean (either BMT or CMT) the transaction needs to start and end within a business method i.e we cannot end a method without ending the transaction. Moreover in SLSB the bean instance is associated with the client only during the Business method call. Hence during ejbCreate() and ejbRemove() having a transaction reference really doesnt help
I can't take it! You are too smart for me! Here is the tiny ad: