This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills: The software developer's life manual and have John Sonmez on-line!
See this thread for details.
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question about ejbCreate() and ejbRemove() in Stateless SB or MDB

 
Galder Zamarre´┐Żo
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been looking into the cheat sheets available through JavaRanch and i have a question about them:

They seem to indicate that in BMT Stateless Session beans or Message Driven Beans, Transaction details (via getUserTransaction) are available through ejbCreate() and ejbRemove()

I think that this is wrong, can anyone confirm or deny this?

The reason why i think this is wrong is that bean creation and removal is not dependant on any of the user's action and therefore, does not make sense to be able to delimitate a transaction when you do not even know when it happens.

Thanks for your help
 
M Murthy
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


According to the spec. pg 90 Table 3, It clearly states that BMT stateless session beans can call EJBContext.getUserTransaction() in ejbCreate() and ejbRemove() methods, but UserTransaction methods (begin(), commit() etc...)can be called only in the business method from component interface.

Same logic for Message Driven Beans (spec pg. 320 Table 12).

Whereas in case of stateful session beans you can call EJBContext.getUserTransaction() and also methods on UserTransaction in ejbCreate()/ejbRemove()/ejbActivate()/ejbPassivate()/Business Methods

Hope this helps.

[ November 29, 2004: Message edited by: M Murthy ]
[ November 29, 2004: Message edited by: M Murthy ]
 
Galder Zamarre´┐Żo
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i understand it now. that's a very shuttle difference isn't it? that can really confuse you.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic