Chapter 7.
Developing Session Beans
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
create(...)
methods. Each
create
method
must be named
create
and must match one of the
ejbCreate
methods defined in the enterprise
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
create
method that takes no argu-
ments.
Содержание Application Server
Страница 1: ...Red Hat Application Server JOnAS User Guide ...
Страница 8: ......
Страница 22: ...14 Chapter 1 Java Open Application Server JOnAS a J2EE Platform ...
Страница 58: ...50 Chapter 3 JOnAS Configuration ...
Страница 66: ...58 Chapter 5 JOnAS Class Loader Hierarchy ...
Страница 78: ...70 Chapter 6 JOnAS Command Reference ...
Страница 80: ......
Страница 86: ...78 Chapter 7 Developing Session Beans ...
Страница 136: ...128 Chapter 9 Developing Message Driven Beans ...
Страница 142: ...134 Chapter 10 Defining the Deployment Descriptor ...
Страница 148: ...140 Chapter 11 Transactional Behavior of EJB Applications ...
Страница 158: ...150 Chapter 14 EJB Packaging ...
Страница 162: ...154 Chapter 15 Application Deployment and Installation Guide ...
Страница 164: ......
Страница 176: ...168 Chapter 18 WAR Packaging ...
Страница 178: ......
Страница 184: ...176 Chapter 20 Defining the Client Deployment Descriptor ...
Страница 186: ...178 Chapter 21 Client Packaging ...
Страница 188: ......
Страница 192: ...184 Chapter 23 EAR Packaging ...
Страница 194: ......
Страница 200: ...192 Chapter 24 JOnAS Services ...
Страница 204: ...196 Chapter 25 JOnAS and the Connector Architecture ...
Страница 222: ...214 Chapter 27 Ant EJB Tasks Using EJB JAR ...
Страница 234: ...226 Chapter 29 Web Services with JOnAS ...
Страница 236: ......
Страница 260: ...252 Chapter 34 How to use Axis in JOnAS ...
Страница 270: ...262 Chapter 36 Web Service Interoperability between JOnAS and BEA WebLogic ...
Страница 296: ......