50
Chapter 5 Introduction to EJB
provide a high-level interface facade to business processes, in which session bean methods
perform a unit of work, calling one or more methods in one or more entity beans.
For more information, see JRun Programmer’s Guide.
Stateful session beans
You can perform some business processes in a single business request, such as computing
the price of goods or verifying a credit card account. Other business processes are more
drawn out and last across multiple requests and transactions. For example, on an
e-commerce website, adding items to an online shopping cart spans multiple method
requests. The business process must track the user’s state from request to request. Stateful
session beans maintain a conversational state on behalf of a client. If a stateful session
bean changes during a method invocation, that same state is available to the client on the
following invocation.
When used in a clustered environment, JRun supports failover by maintaining stateful
session-bean state across the cluster.
For more information, see JRun Programmer’s Guide.
Entity beans
Entity beans represent objects that persist through a server shutdown. The data
representing an instance of an entity bean is typically stored in rows and tables of a
relational database, which you access using a JDBC data store. These tables can also span
multiple databases.
There are two types of entity bean persistence:
•
Bean-managed persistence (BMP)
The entity bean implementation manages
persistence by coding database access and update statements in callback methods.
•
Container-managed persistence (CMP)
The container uses specifications made
in the deployment descriptor to perform database access and update statements
automatically.
BMP
In BMP, the developer manages persistence by coding the appropriate database update
code in callback methods. For example, the
ejbUpdate
method updates the database,
and the
ejbFindByPrimaryKey
method locates a database row using the primary key.
For more information, see the
CreditCard
and
Reservation
EJBs in the compass-ear
directory of the samples server.
CMP
In CMP, the container manages persistence by automatically synchronizing the bean with
the database at certain points in the lifecycle. With CMP, your bean implementation
coding is simpler and can focus on the business logic.
The EJB 2.0 specification requires that application servers support EJB 1.1 CMP and
EJB 2.0 CMP.
Summary of Contents for 38000382 - Macromedia JRun - Mac
Page 1: ...Getting Started with JRun...
Page 16: ......
Page 68: ...54 Chapter 5 Introduction to EJB...
Page 82: ......
Page 110: ...96 Lesson 3 EJB Tutorial...
Page 128: ...114 Lesson 4 Web Services Tutorial...
Page 132: ...118 Index...