Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Enterprise JavaBeans™ Specification, Version 2.0 - Sun Microsystems.pdf
Скачиваний:
14
Добавлен:
24.05.2014
Размер:
2.71 Mб
Скачать

Sun Microsystems Inc

Session, entity, and message-driven objects

Enterprise JavaBeans 2.0, Public Draft

Overview

4.3 Session, entity, and message-driven objects

The Enterprise JavaBeans architecture defines three types of enterprise bean objects:

A session object.

An entity object.

A message-driven object.

4.3.1 Session objects

A typical session object has the following characteristics:

Executes on behalf of a single client.

Can be transaction-aware.

Updates shared data in an underlying database.

Does not represent directly shared data in the database, although it may access and update such data.

Is relatively short-lived.

Is removed when the EJB Container crashes. The client has to re-establish a new session object to continue computation.

A typical EJB Container provides a scalable runtime environment to execute a large number of session objects concurrently.

Session beans are intended to be stateful. The EJB specification also defines a stateless Session bean as a special case of a Session Bean. There are minor differences in the API between stateful (normal) Session beans and stateless Session beans.

4.3.2 Entity objects

A typical entity object has the following characteristics:

Provides an object view of data in the database.

Allows shared access from multiple users.

Can be long-lived (lives as long as the data in the database).

The entity, its primary key, and its remote reference survive the crash of the EJB Container. If the state of an entity was being updated by a transaction at the time the container crashed, the

45

5/31/00