👉 What is EJB and specify its components?
* It is a specification given by Sun's Micro-system to develop secured, robust and scalable distributed systems.
* It is a server side component and hence reusable.
* It is similar to a java class and typically contains the business logic.
* There are mainly 3 types of EJB's
1. Entity Bean.
3. Message driven.
👉 What is Enterprise Java Server(EJS) ?
* The EJS is the server where the EJB is deployed (Server-side).
* This is a part of the application server that hosts the EJB container.
* EJB cannot directly interact with the EJS whereas it uses a middleware.
* EJB specification outlines eight services that must be provided by the EJS such as :
👉 Briefly explain the EJB components ?
* First lets categorize the EJB as follows which makes it easier to understand the concepts:
* EJB components are categorized as synchronous and asynchronous.
* Entity bean and the session bean are categorized in the synchronous block while the message driven bean is an asynchronous block.
* The Entity bean is further classified as Container Managed Persistence (CMP) & Bean Managed Persistence (BMP).
* The session bean is further classified as stateless and stateful.
NOTE : Lets consider the Student Management System for explaining the EJB components further.
👉 What is an Entity Bean in EJB components ?
👉 What is an Session Bean in EJB components ?
* There are 2 types of session beans mainly :
1. Stateless Session Bean (SLSB).
* It is not essential to remember the client state when considering the SLSB.
* @Stateless annotation is used to denote a SLSB.
* The optional lifecycle callback events are @PostConstruct and @PreDestroy.
2. Stateful Session Bean (SFSB).
* Maintains the conversational state of the client.
* Each instance in the SFSB maintains an instance of the client.
* @Stateful annotation is used to denote a SFSB.
* The optional lifecycle callback events are @PostConstruct and @PreDestroy.
* Lets consider out Student management example.