Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Use of SessionContext and EjbContext

 
amit vikram ghajni
Greenhorn
Posts: 9
Java Java ME Netscape
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
RohitMisra Rm
Greenhorn
Posts: 3
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
Java Java ME Netscape
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic