What is Enterprise JavaBeans (EJB)? - Javastudypoint

Monday, December 24, 2018

What is Enterprise JavaBeans (EJB)?

EJB stands for Enterprise JavaBeans. EJB is a server-side component written in Java programming language. Enterprise JavaBeans encapsulates the business logic of applications. Enterprise JavaBeans are typically deployed in EJB container and run on EJB server.
EJB in Java
Enterprise JavaBeans
EJB container provides the environment in which one or more Enterprise JavaBeans run. It provides the following control and management services.
  • Life Cycle Management.
  • Naming services.
  • Security checks.
  • Resource pooling.
  • persistence management.
  • Transactions coordinations.
  • Bean runtime context information(meta data).



Types of Enterprise JavaBeans:

There are three types of Enterprise JavaBeans - Session beans, Entity beans, and Message-driven beans.


1. Session Bean:

Session Bean stores the information of the particular client for a single session. Ecan Session bean is usually associated with one EJB client. It is created and destroyed by the particular client that is associated with it. It either can have stateless or stateful. A session bean may be destroyed when the EJB server crashes. Session bean does not represent data that must be stored in a database.

2. Entity Bean:

It represents persistent data storage. In a persistent storage mechanism, an Entity bean represents a business object. A relational database is the persistent storage mechanism in the application server. An entity bean may be shared by multiple EJB clients. An entity bean can share access from many users. These are persistent and can survive when the EJB server crashes.

3. Message-Driven Bean:

This is the third form of EJB, which is initiated by a request sent from Java Message Service (JMS). Message-Driven bean contains the business logic just like the session bean but it is invoked by passing the message. It can
consume JMS messages from external entities.

Benefits of Enterprise JavaBeans (EJB):

  • Enterprise JavaBeans simplifies the development of large, and distributed applications.
  • The EJB container - and not the Bean Developer - provides system-level services, such as Transaction management and security authorization. So the developer has to focus only on the business logic of the applications.
  • These are portable components, the developer can build new applications from the existing beans.



Disadvantages of Enterprise JavaBeans (EJB):

  • To run the EJB applications, it requires application server.
  • To develop the EJB applications, it requires only Java Developer.
  • Complex to develop EJB applications.

You may also like:








No comments:

Post a Comment