Overview of enterprise java bean ejb
1 / 17

Overview Of Enterprise Java Bean (EJB) - PowerPoint PPT Presentation

  • Uploaded on

Overview Of Enterprise Java Bean (EJB). COSC 513 Presentation Mei Li March 17, 2001. What is EJB ?. Widely adopted N-tier sever side component architecture for J2EE. Allows developers to quickly create scalable, versatile, reusable and portable applications.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Overview Of Enterprise Java Bean (EJB)' - khuyen

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Overview of enterprise java bean ejb

Overview Of Enterprise Java Bean (EJB)

COSC 513 Presentation

Mei Li

March 17, 2001

What is ejb
What is EJB ?

  • Widely adopted N-tier sever side component architecture for J2EE.

  • Allows developers to quickly create scalable, versatile, reusable and portable applications.

  • It provide complex middleware enterprise features at no cost to application developers.

N tier sever side component architecture
N-tier Sever side component architecture

Presentation Logic

Presentation Layer




Shopping cart

Business Logic Layer

DB Driver

Data Layer


The benefits of ejb
The Benefits of EJB

  • Rapid application development

  • Broad industry adoption

  • Application portability

    • Business logic is platform independent and middleware independent.

  • Protection of IT investment

    • wrap or embrace existing infrastructure

    • simplifies or enhances CORBA and DCOM

Ejb architecture
EJB Architecture

EJB Server & Container

Home Interface



Home Object







EJB Object

Remote Interface

(1) Create me a new EJB object (2) Create EJB object

(3) Return EJB object reference (4) Invoke business method

(5) Delegate request to bean

Ejb server
EJB Server

  • Providing a runtime environment for one or more containers.

  • Managing low-level system resources, allocating resources to containers, multiprocessing, load balancing, providing naming and transaction service and making container visible.

Ejb container
EJB Container

  • Providing a playground where your enterprise beans can run.

  • Responsible for managing the beans running within them.

  • Acting as an interface between your enterprise beans and the outside world. Client can never directly access your enterprise beans.

Ejb client
EJB Client

  • Making use of EJB beans for operations.

  • Finding the home object through JNDI.

  • Invoking the business method on EJB object.

  • Can be servlets, applets, CORBA / IIOP EJB clients, etc.

Enterprise beans
Enterprise Beans

  • There are two types of Enterprise Beans:

    • Session Beans

      • Stateless session beans

      • stateful session beans

    • Entity Beans

      • Bean managed persistent entity beans (BMP)

      • container managed persistent entity beans (CMP)

Session beans vs entity beans

Session Bean

represent a business process, e.g. Billing credit card, trading stocks.

is associated with one client and the life of the session bean is the life of the customer.

do not survive from the server crashes

Entity Bean

representation of persistent data

can be shared by multiple clients

can read from DB and save back to DB

has much longer life and can survive from server crashes

Session Beans vs. Entity Beans

Activation vs passivation


When a client needs to use a bean that has been passivated, an activation process occurred.

The state of the bean is swapped in from the persistent storage


If too many beans are instantiated, EJB container can passivate some of them

the state of the bean is saved in a persistent store or file and swapped out

Activation vs. Passivation

Stateless vs stateful


no internal state

can be pooled to service multiple client

need not to handle activation and passivation

examples: calculator


possess internal state

need to hand activation and passivation

examples: shopping cart

Stateless vs. Stateful

Container managed persistent vs bean managed persistent

Container Managed

EJB container is responsible for saving and retrieving bean’s state

Independent of data source

Easy to develop

Bean Managed

Entity bean is responsible for saving bean’s state.

Less adaptive than container managed entity bean

persistence need to be hard coded into the bean

Container Managed Persistent vs. Bean Managed Persistent

Deployment descriptor
Deployment Descriptor

  • An essential part of EJB. Use XML after EJB1.1

  • Enables EJB containers to provide implicit middleware services to enterprise beans without coding to any middleware API.

  • It declares bean management and life-cycle requirement, persistence requirement (entity bean only), transaction requirements and security requirements


  • EJB is server side components written in JAVA

  • EJB components contains business logic only, no system-level programming

  • System-level service like transaction, security, threading, and persistence are automatically managed by EJB server/container.

Summary cont s
Summary (cont’s)

  • Components are declaratively customized (can customize transactional behavior, life-cycle, state management, security issue.)

  • EJB architecture are transactional, distributed, portable, multi-tier, scalable and secure.

  • EJB components are fully portable across any EJB server and any operating system.