This week's book giveaway is in the Spring forum.
We're giving away four copies of Java Persistence with Spring Data and Hibernate and have Cătălin Tudose on-line!
See this thread for details.
Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

Transactional Context of Session Beans

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

I was wondering why session beans's create methods have an "unspecified transaction context"? Is it true for both CMT/BMT stateful/stateless session beans? I ask because on page 470 of HFEJB in "What It Means" Section it says "A session bean's create method runs in an 'unspecified transaction context'"

However in Valentine's cheat sheets I notice that stateful BMT AND stateless BMT beans are able to access "getUserTransaction()". How is it possible with a stateless session beans which are supposed to be in a pool? I can consider stateful session beans having such abilities because they are after all created just in time for the client, but stateless BMT beans?

The diagram of stateless BMT beans also mentions twice userTransaction (first getUserTransaction() and then UserTransaction interface) What is the difference between accessing getUserTransaction and getting access to the UserTransaction interface? Doesn't calling getUserTransaction give you access to the methods of the interface?
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A session bean create method runs with unspecified transaction context is
true for CMT/BMT Stateful/Stateless session bean.


You can get UserTransaction object through EJBContext.getUserTransaction or
InitialContext initCtx=new InitialContext();
UserTransaction ut= initCtx.lookup("java:comp/UserTransaction");
both are functionally similar

A client to stateless SB need not exist when you get reference UserTransaction object and access method on it.
 
Getting married means "We're in love, so let's tell the police!" - and invite this tiny ad to the wedding:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic