Entity Beans
While session beans are our verbs, entity beans are the nouns. Their aim is to express an object view of resources stored within a Relational Database Management System (RDBMS)—a process commonly known as object-relational mapping.
Like session beans, the entity type is modeled as a POJO, and
becomes a managed object only when associated with a
construct called the javax.persistence.EntityManager,
a container-supplied service that tracks state changes and
synchronizes with the database as necessary. A client who alters the state
of an entity bean may expect any altered fields to be propagated to
persistent storage. Frequently the EntityManager will cache both reads and writes to transparently
streamline performance, and may enlist with the current transaction to
flush state to persistent storage automatically upon invocation completion
(Figure 2-6).

Figure 2-6. Using an EntityManager to map between POJO object state and a persistent relational database
Unlike session beans and MDBs, entity beans are not themselves a
server-side component type. Instead, they are a view that may be detached
from management and used just like any stateful object. When detached
(disassociated from the EntityManager),
there is no database association, but the object may later be re-enlisted
with the EntityManager such that its state may again be synchronized. Just as session beans are EJBs only ...