Skip to Main Content
Enterprise JavaBeans 3.1, 6th Edition
book

Enterprise JavaBeans 3.1, 6th Edition

by Andrew Lee Rubinger, Bill Burke
September 2010
Intermediate to advanced content levelIntermediate to advanced
766 pages
18h 35m
English
O'Reilly Media, Inc.
Content preview from Enterprise JavaBeans 3.1, 6th Edition

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).

Using an EntityManager to map between POJO object state and a persistent relational database

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Reinventing the Organization for GenAI and LLMs

Reinventing the Organization for GenAI and LLMs

Ethan Mollick
JavaServer Faces

JavaServer Faces

Hans Bergsten
EJB 3 Developer Guide

EJB 3 Developer Guide

Michael Sikora

Publisher Resources

ISBN: 9781449399139Errata Page