About Entity Beans

An entity bean is an EJB that models data typically stored in a database, also called persistent data. This type of bean usually exists as long as the data it is associated with exists.

Each entity EJB represents a set of data, such as the columns in a database table. Each instance of the entity EJB contains one element of that data, such as a row from a database table.

Methods of the entity EJB's home interface allow clients (or other users of the EJB) to find entities already in the database, insert new entities into the database, and so on. These methods are defined in the EJB specification.

The entity bean really holds the data. If two clients execute the same find operation, both get handles to the same entity bean instance. Any Contention is handled by regarding each of these as a separate transaction. The entity bean's transactional mode determines what happens when one or more clients do a store or replace on the same instance.

The bean can provide persistence in two ways: