J2EE – Enterprise Bean

Introduction

Enterprise Bean is a server-side component that encapsulates business logics.

 

Why Enterprise Bean?

  • Because application service provides a lot of system-level service. Developers can concentrate logic in Enterprise Bean
  • Server-side Enterprise Bean is responsible for business logic while client-side component can focus on presentation.

The application server provide services including transaction handling, logging, load balancing, persistence and exception handling.

 

Types of Enterprise Bean

  • Session Bean
  • Message Driven Bean

The Session Bean performs task for client while Message-Driven Bean acts as listener for particular message (MQ).

 

Session Bean

Session bean could be further classified as two types of bean

  • Stateful Bean
  • Stateless Bean

Stateful bean contain state information while Stateless bean doest not.

Client Types

The session bean could be access by different clients.

Client Requirement
Local Same Application(One is Web Modules and Another is EJB Modules)
Remote Can be Different Machine, Different JVM
Web Service Access EJB through correct Protocol

 

Example List

 

Reference