Providing concurrent access by multiple clients When the state and behavior of a business object needs to be shared among multiple clients, they should be modeled as entity beans. This kind of business object needs to maintain state between method calls. However, this state is not specific to a particular client but is representative of persistent state of the business object, typically stored in a database. By modeling such business objects as entity beans, a Bean Provider can rely on an EJB server to ensure appropriate synchronization for entity beans as they are accessed concurrently from multiple transactions. The business objects that typically operate on one logical record in the database are excellent candidates to model as entity beans.
Entity beans provide methods to locate, create, and manipulate one row at a time.
A business object that needs to live after a client's session with the server is over or that needs to be present when the server comes back after a crash, should be modeled as an entity bean. Entity beans live even after a client's session with the server is over and can even survive server crashes. If the state of an entity bean is being updated by a transaction at the time of server crash, the entity bean's state is automatically reset to the state of the last committed transaction. The concept of a user account is central to all clients in many e-commerce applications. Multiple clients need to share behavior such as creating an account, verifying an existing account, and updating account information.