eWebProgrammer eweb  





Entity Beans   «Prev  Next»
Lesson 1

Introduction to Entity Beans

This module introduces entity beans and discusses their architecture and will look at how entity beans differ from session beans.

Primary keys

Entity beans represent some persistent data that is stored somewhere on-line, locally, or remotely. As this data is unique and has a unique identity, entity beans use primary keys to identify them. You will learn to create and use these primary keys.
Primary key: Uniquely identifies a row in a database.

Bean-managed and container-managed persistence

With entity beans, there are two kinds of persistence. When the programmer writes code that stores and retrieves the data within the bean, it is called bean-managed persistence.
If this responsibility is delegated to the container, which then reads and writes the data automatically on behalf of the bean, it is known as container-managed persistence .

  1. container-managed-persistence: The persistence of the data is managed by the ejb container.
  2. bean-managed-persistence: The enterprise java bean itself is responsible for storing and restoring its state to and from the database.

Entity bean lifecycle

You will be introduced to the lifecycle of the entity bean. It describes how the container manages the EJBObject, the instances, and their primary keys.




The next lesson introduces the architecture of entity beans.