This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Unspecified Transaction Context

 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does a BMT stateless bean's ejbCreate comes under unspecified transaction context? Pg 228 HFE says that from an ejbCreate method "one cannot get a transaction reference and call methods on it (BMT Beans)".
although the former part is wrong coz we can obtain a transaction reference from the method (EJB Spec pg 90 table 3). So if it really runs in "unspecified transaction" then why is it not mentioned in 499?
Or is it that "Unspecified Transaction" applies only for CMT beans?
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose that you can call getUserTransaction() within ejbCreate()-method of stateless session bean with BMT, but it's not allowed (maybe throws an IllegalStateException?) to call any methods of it. Why? Because ejbCreate() is called by the container prior to putting the bean to the pool.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is probably a misprint on page 228 in "head first ejb" book. Stateless BMT bean should be able to begin a new transaction in ejbCreate().
 
Victor Lar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to do it in WebSphere 5.1 and it did not allow me to call begin(): it throws NullPointerException in com.ibm.ejs.container.UserTransactionWrapper.begin(UserTransactionWrapper.java:185)
But it works fine when I called getUserTransaction().getStatus(): it returned STATUS_NO_TRANSACTION.
 
Sudhir V
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So probably the Pg 228 bullet shud split it as two points
. get a transaction reference
. call methods on the retreived transaction reference
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic