Developing Session Beans; Introduction To Session Beans; The Home Interface - Red Hat APPLICATION SERVER - JONAS Manual

Jonas
Hide thumbs Also See for APPLICATION SERVER - JONAS:
Table of Contents

Advertisement

This chapter is for the Enterprise Bean provider; that is, the person in charge of developing the soft-
ware components on the server side and, more specifically, the Session Beans.
Note
In this documentation, the term "Bean" always means "Enterprise Bean."

7.1. Introduction to Session Beans

A Session Bean is composed of the following parts, which are developed by the Enterprise Bean
provider:
The Component Interface is the client view of the bean. It contains all the "business methods" of
the bean.
The Home Interface contains all the methods for the bean life cycle (creation, suppression) used by
the client application.
The bean implementation class implements the business methods and all the methods (described in
the EJB specification), allowing the bean to be managed in the container.
The deployment descriptor contains the bean properties that can be edited at assembly or deploy-
ment time.
Note that, according to the EJB 2.0 specification, the couple "Component Interface and Home Inter-
face" may be either local or remote. Local Interfaces (Home and Component) are to be used by a
client running in the same JVM as the EJB component. Create and finder methods of a local or remote
home interface return local or remote component interfaces respectively. An EJB component can have
both remote and local interfaces, even if typically only one type of interface is provided.
The description of these elements is provided in the sections that follow.
A Session Bean object is a short-lived object that executes on behalf of a single client. There are
stateless and stateful Session Beans. Stateless Beans do not maintain state across method calls. Any
instance of stateless beans can be used by any client at any time. Stateful Session Beans maintain state
within and between transactions. Each stateful session bean object is associated with a specific client.
A stateful Session Bean with container-managed transaction demarcation can optionally implement
the SessionSynchronization interface. In this case, the bean objects will be informed of transaction
boundaries. A rollback could result in a Session Bean object's state being inconsistent; in this case,
implementing the SessionSynchronization interface may enable the bean object to update its state
according to the transaction completion status.

7.2. The Home Interface

A Session Bean's home interface defines one or more
must be named
create
Bean class. The return type of a create method must be the enterprise Bean's remote interface type.
The home interface of a stateless Session Bean must have one
ments.

Developing Session Beans

and must match one of the
methods. Each
create(...)
methods defined in the enterprise
ejbCreate
create
Chapter 7.
create
method that takes no argu-
method

Advertisement

Table of Contents
loading

This manual is also suitable for:

Application server

Table of Contents