
27/10/141 /XX MÔN: L P TRÌNH M NG 2Ậ Ạ GV: NGUY N XUÂN VINHỄ
TR NG Đ I H C NÔNG LÂM TP.HCMƯỜ Ạ Ọ KHOA CÔNG NGH THÔNG TINỆ
EJB: Stateful Session Bean
Presenter: Nguy n Xuân Vinhễ
Information Technology Faculty
Nong Lam University

27/10/142 /XX MÔN: L P TRÌNH M NG 2Ậ Ạ GV: NGUY N XUÂN VINHỄ
TR NG Đ I H C NÔNG LÂM TP.HCMƯỜ Ạ Ọ KHOA CÔNG NGH THÔNG TINỆ
Session Objectives
Define a Stateful Session Bean
List the characteristics of a Stateful Session Bean.
Write Stateful session bean programs.
Differentiate between Stateless and Stateful Session beans.

27/10/143 /XX MÔN: L P TRÌNH M NG 2Ậ Ạ GV: NGUY N XUÂN VINHỄ
TR NG Đ I H C NÔNG LÂM TP.HCMƯỜ Ạ Ọ KHOA CÔNG NGH THÔNG TINỆ
Review of Session 3 (1 of 3)
The bean class, the EJB object, the remote interface, the home interface, the
home object, the deployment descriptors, and the jar files constitute the
enterprise bean.
Bean class contains the implementation of the business logic methods.
EJB container performs important management functions when it intercepts
client requests such as:
* Transaction logic
* Security logic
* Bean instance logic
The Remote interface duplicates the methods exposed by the bean class.
Responsibilities of the EJB home object:
* Creating EJB objects
* Searching for existing EJB Objects
* Removing EJB Objects

27/10/144 /XX MÔN: L P TRÌNH M NG 2Ậ Ạ GV: NGUY N XUÂN VINHỄ
TR NG Đ I H C NÔNG LÂM TP.HCMƯỜ Ạ Ọ KHOA CÔNG NGH THÔNG TINỆ
Review of Session 3 (2 of 3)
The deployment descriptor: A file that tells the EJB server about
the classes, the home interface, and the remote interface that
form the bean.
The lifetime of a session bean may last till such time as that of a
client session. It could be as long as a window is open or as
long as an application is open. Session beans do not, therefore,
survive application server crashes or machine crashes.
Three classes are essential for deployment:
Home Interface
Remote Interface
Bean class

27/10/145 /XX MÔN: L P TRÌNH M NG 2Ậ Ạ GV: NGUY N XUÂN VINHỄ
TR NG Đ I H C NÔNG LÂM TP.HCMƯỜ Ạ Ọ KHOA CÔNG NGH THÔNG TINỆ
Review of Session 3 (3 of 3)
The ejb-jar.xml file is a compressed file that contains
the declarations of the enterprise bean class, the
remote interface and the home interface.
An EJB client can be:
* An ordinary JavaBean
* Another EJB
* A JSP Page
* A servlet
* An applet
*A stand-alone application

