What Is an Entity Bean?

On the surface, an entity bean is similar to a session bean. They both have Home and Remote interfaces and an implementation class. They are both subject to many of the same restrictions. The big difference between entity beans and session beans is in the area of persistence and the implications stemming from it.

An entity bean represents persistent data—that is, data stored in some kind of database. Various client classes, which can be session beans, entity beans, or application programs, manipulate entity beans and save them back to the database. These operations always take place within the scope of a transaction.

Because an entity bean represents a piece of data that is accessible to multiple users, the entity beans ...

Get Special Edition Using Java™ 2 Enterprise Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.