• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getUserTransaction() in ejbCreate() for stateless session bean

 
Colin Richardson
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Dilli raj
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic