This week's book giveaway is in the Java in General forum.
We're giving away four copies of 97 Things Every Java Programmer Should Know and have Kevlin Henney & Trisha Gee on-line!
See this thread for details.
Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

getUserTransaction() in ejbCreate() for stateless session bean

 
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?
 
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
 
You save more money with a clothesline than dozens of light bulb purchases. Tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic