Tuesday, 19 April 2016

Session context vs. Entity context


Since EnterpriseBeans live in a managed container, the container is free to call your EJB components methods at its leisure.

The container houses the information like current status of bean, security credentials of the user currently accessing the bean in one object is called EJBContext Object.

EJBContext is an interface that is implemented by the container, and itis also a part of the bean-container contract.
Entity beans use a subclass of EJBContext called EntityContext.
Session beans use a subclass called SessionContext.
These EJBContext objects provide the bean class with information about its container, the client using the bean and the bean itself.

A context represents a way for beans to perform callbacks and modify their current status :
  • Session context is EJB context for session bean
  • Entity context is EJB context for entity bean
  • Message driven context is EJB context for message driven bean

No comments:

Post a Comment

Note: only a member of this blog may post a comment.