• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

confusion over bean things

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

I am having confusion over understanding bean things. The life cycle of stateless session bean and MessageDrivenBean is more or less same. In case of MDB, we can access getUserTransaction in ejbCreate/ejbRemove methods. But not in stateless session bean's ejbCreate/ejbRemove method. Why?

What are the rules for accessing getuserTransaction() method?

Thanks,
Prashant
 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Prashant,this is a tricky thing. Actually if you look carefull at the spec you realise that SLSB and MDB are the same from the getUserTransaction() point of view.

So here it is a summary:

1. SLSB and MDB, are both allowed to call getUserTransaction() in ejbCreate() and ejbRemove() but they are not alowed to use it! That is why Kathy, on pg 228, puts these two things together: "get a transaction reference and call methods on it (BMT)" - is not allowed! See also pg 90 and 320 in the spec.
2. SFSB are alowed both to call getUserTransaction() and to call methods on it (see pg. 80).

However, to make it even more confusing, it is definately not recommended to use the UserTransaction even if you can, for SFSB, since they run in an UTC(unspoecified tx context). 7.5.6, pg 76.

Personally I think the spec could have dealed in the same way with getUserTransaction() as with "Resource manager access". Just say that you can not acess the user transaction in ejbCreate() and ejbRemove() for SLSB and MDB. Not to specify that you can call the getUSerTransaction() method, but you can not use the UserTransaction. Because you can look up a resource manager connection factory, and you can get a connection in ejbCreate() and ejbRemove(). But still you can not make JDBC calls on it!

Hope this is clear now.

Miki
 
Prashant Neginahal
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ya it is clear now. Thanks Miki.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic