Entity Beans and Locking
Entity beans are transactional, shared resources, simultaneously used by many clients. Clearly, to ensure that clients view consistent data, the EJB container and the database must enforce concurrency control. Entity EJBs are not written as re-entrant or thread-safe components. Each entity bean instance never has more than one thread of control in its object. This simplistic concurrency control is handled by the EJB container and mandated by the EJB specification. For this reason, methods in the entity bean class are not synchronized.
The database also provides concurrency control. The entity bean interacts with the database through its data access code and transactions. Generally, the database knows ...