Enterprise Java Bean
Enterprise Java Bean
Enterprise Java Bean
Enterprise JavaBean(EJB)
EJB is a server side component that contains business logic of an
application
EJB class focusses on writing business logic to respond to requests of web-
services without bothering about system-level services.
EJB server takes care of system level services such as security,transaction
and persistance using EJB written them.
Architecture of EJB
Web Server
Client
Web container
Browser Servlets and JSP
Application
container
Appln
EJB Server
Appln
EJB Container
EJB DB
EJB
Need of EJB
Generally EJB is useful in building enterprise-level application.
Olden days CORBA had been used which has the following problems
Outdated persistence
Lacks scalability,portability
Advantages of EJB
Simplicity
Reusability
Scalability
Portability
EJB Container
Remote Interface
It contains lists of business methods to implement business logic of EJB
EJB Class
There are 3 types of classes in EJB
1. Entity Bean
This contains persistent data and provides persistent
storage to that data in a database
2. Session Bean
It describes the task to be done for a client
3. Message Driven Bean
This bean is to process messages asynchronously i.e., it is
used for operations which do not require immediate
response
Entity Bean
This contains persistent data and provides persistent storage to the data in db.
Data collected and managed by an entity bean is referred to as persistent data
Two types
Bean managed persistence:
persistence of data is handled by itself
Container managed persistence:
persistence is handled by container