EJB
EJB is a server-side software element that summarizes business logic of an application
Enterprise Java Beans
web repository yields aruntime domain
for web related software elements includingcomputer reliability
,Java Servlet Lifecycle (JSL) management
,transaction procedure
and otherweb services
.
Types
- Session Bean: Session bean contains business logic that can be invoked by local, remote or webservice client.
- Message Driven Bean: Like Session Bean, it contains the business logic but it is invoked by passing message.
- Entity Bean: It summarizes the state that can be remained in the database. It is deprecated. Now, it is replaced with JPA (Java Persistent API).
When to use Enterprise Java Beans
- Application needs
Remote Access
. In other words, it isdistributed
. - Application needs to be
scalable
. EJB applications supportsload balancing
,clustering
andfail-over
. - Application needs
encapsulated business logic
. EJB application is differentiated from demonstration and persistent layer.