This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Use of SessionContext and EjbContext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Use of SessionContext and EjbContext" Watch "Use of SessionContext and EjbContext" New topic
Author

Use of SessionContext and EjbContext

amit vikram ghajni
Greenhorn

Joined: Feb 02, 2011
Posts: 9

hi,
someone please explain the uses of sessioncontext and EjbContext.why it is there?how it fits to the architecture of EJB ?I need the understanding of it.please help

note:- Please don't say how to use it?I can find it in books.
thanks in advance.


amit vikram
RohitMisra Rm
Greenhorn

Joined: Aug 27, 2012
Posts: 3
Hi Amit
I think you should include the MessageDrivenContext and EntityContext as well in order to understand the whole picture.
The above two, in addition to SessionContext are subclasses of EJBContext .

The EJBContext provides access to the container-provided runtime context of an enterprise bean instance. For example a bean can find out about the user that invoked that bean with the use of getCallerPrincipal() and isCallerInRole() methods, or lookup a resource in the bean's naming context using the lookup() method.

The subclasses have specialized methods according to the requirements of the bean type they serve. For eg, SessionContext has getEJBLocalObject and getEJBObject methods to pass a reference to the bean itself in a method argument or result. Such functionality is not required by MDBs, so these methods are absent in the MessageDrivenContext.

Hope that helps.
- Rohit
amit vikram ghajni
Greenhorn

Joined: Feb 02, 2011
Posts: 9

RohitMisra Rm wrote:Hi Amit
I think you should include the MessageDrivenContext and EntityContext as well in order to understand the whole picture.
The above two, in addition to SessionContext are subclasses of EJBContext .

The EJBContext provides access to the container-provided runtime context of an enterprise bean instance. For example a bean can find out about the user that invoked that bean with the use of getCallerPrincipal() and isCallerInRole() methods, or lookup a resource in the bean's naming context using the lookup() method.

The subclasses have specialized methods according to the requirements of the bean type they serve. For eg, SessionContext has getEJBLocalObject and getEJBObject methods to pass a reference to the bean itself in a method argument or result. Such functionality is not required by MDBs, so these methods are absent in the MessageDrivenContext.

Hope that helps.
- Rohit


thanks rohit. I am getting the complete picture now.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Use of SessionContext and EjbContext
 
Similar Threads
How do I setRollBackOnly on a sessionBean using CMT and JTA
Using JNDI lookup to get access to the EJB
How to get SessionContext ???
allowed operation in ejbCreate() of stateless session bean
Stateless session bean ejbCreate()