EJB architecture defines two types of enterprise beans: session and entity. |
Session beans execute on behalf of a single client, can be transaction-aware, updates the shared data in database, is relatively short-lived, and is removed when the EJB container crashes. |
Entity beans provide an object view of transactional data in the database, allow shared access from multiple clients, can be long-lived and survive when the EJB Container crashes. |
Entity beans have its primary key therefore it is still accessible after the container crashes and restarts. When the EJB Container restarts, the entity bean restarts from its last saved state. |