An
Entity bean[1] is associated with some persistent information somewhere.
The bean object actually has a one-to-one relationship with the information that is stored permanently.
One of the other major differences between session and entity beans is that entity bean instances are shared between multiple clients.
This is because multiple client programs may require access to the same data at the same time.
Entity beans use transactions to prevent concurrent access by multiple clients from corrupting the values in the data inadvertently.
Transactions are also required if other non-EJB programs are accessing the data simultaneously.
A typical EJB container and server will provide a scalable runtime environment for a large number of concurrently active entity objects.
An example of an entity bean is a Customer, a BankAccount, or a Product that maps to rows in actual databases.
Click the Quiz link below to make sure you understand the different types of beans.
Entity Bean - Quiz
In the next lesson, the deployment descriptor and the jar file used to package a bean will be discussed.