Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Transactional Context of Session Beans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Transactional Context of Session Beans" Watch "Transactional Context of Session Beans" New topic
Author

Transactional Context of Session Beans

Arthur Orange
Ranch Hand

Joined: Dec 29, 2004
Posts: 30
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?


SCJP, SCWCD, SCBCD, ICAD
Krishnaraj Govindaraju
Ranch Hand

Joined: Jan 05, 2005
Posts: 37
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.
 
 
subject: Transactional Context of Session Beans
 
Similar Threads
getUserTransaction
Bean stuff in ejbCreate of stateful session bean
HFE vs EJB Spec - session beans
Doubts in CMT vs BMT beans
(With wonderful replies) what decides access to Resource manager/Enterprise bean?