aspose file tools*
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 Spring in Action this week in the Spring 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.
 
jQuery in Action, 2nd edition
 
subject: Use of SessionContext and EjbContext