Working with Session Beans - PowerPoint PPT Presentation

About This Presentation
Title:

Working with Session Beans

Description:

An instance of stateful session bean is associated with one client. ... Stateful session bean implements a conversational business process. ... – PowerPoint PPT presentation

Number of Views:71
Avg rating:3.0/5.0
Slides: 13
Provided by: kumarm8
Category:

less

Transcript and Presenter's Notes

Title: Working with Session Beans


1
Working with Session Beans
  • B.Ramamurthy

2
Introduction
  • We will session beans from two points of view
  • the session bean developer who implements a
    session bean
  • the client application programmer who uses the
    session bean

3
When to use session beans
  • Session beans is used to implement a stateful
    communication between a client and a server.
  • A session object lasts for the duration of the
    clients session.
  • The duration of a session is the time between the
    creation of the session bean and its removal.
  • During this time, session bean stores the state
    information (conversational state) for the client.

4
When to use .. (contd)
  • Stateful session beans are suitable for the
    following situations
  • To implement session logic of Web applications.
    One or more session beans can be used to
    implement the business process that drives the
    conversation with the user.
  • Example Process that inputs billing and shipping
    information
  • To implement session logic of traditional non-Web
    based applications. Ex Teller of a bank
    interacts with an application to enter multiple
    checks.

5
Session Bean in Web Application
Business Logic
Form generation
Form Display
Web client
JSP, Servlets
Html over http
6
Stateful vs Stateless Session Bean
  • Session bean can stateful or stateless
  • An instance of stateful session bean is
    associated with one client.
  • One to one correspondence between session objects
    and instances of session bean class.
  • Stateful session bean implements a
    conversational business process.
  • state provides a convenient way of retaining
    client-specific state on the server.

7
Stateless Session Bean
  • Does not retain any client specific data.
  • Container has pool of instances of stateless
    session beans and client requests are delegated
    to any available beans.
  • Reused by different clients.
  • Typically implements a procedural service on top
    of a database or legacy application.
  • Ex PayRoll that simple gets db information to
    the user whose identity is given.

8
Conversational State
  • A stateful session bean keeps the server-side
    state on behalf of a single client.
  • This may contain
  • Data read from the database
  • Information entered by the user.

9
Example
  • Application Benefits Enrollment
  • Web application through which an employee manages
    his/her benefits selections.
  • The application lets an employee enter, review,
    and change his/her selection of employer provided
    benefits.
  • Three databases are involed payroll, employee
    and benefits

10
User View
  • User points to an URL.
  • Application displays a sequence of HTML pages
    containing the various benefit choices available
    to the employee.
  • After employee choice it display next screen.
  • It also summarizes the selection.
  • It also indicates the previous selection.
  • After confirmation from the user the application
    updates information.
  • There is a intial login page and final
    confirmation page besides the one shown on page
    62.

11
Main Parts
12
Benefits Enrollment Application
EJB Container1 Deploys PayrollEJB
Database Server Deploys PayrollDatabase
Benefits App Server
Web Container Deploys EnrollementWeb
Database Server Deploys EmployeeDatabase
EJB Container2 Deploys EnrollmentEJB
Enrollment App server
Database Server Deploys Benefits Database
Write a Comment
User Comments (0)
About PowerShow.com