What Does Entity Bean Mean?
An entity bean, in the context of Java Platform 2, Enterprise Edition (J2EE), represents the business objects retained at the end of a session in a persistent storage mechanism. Busi.ness objects may include items like customer name, account number and/or account balance, etc
In J2EE, a relational database is a persistent storage mechanism. In a relational database, there is a table for each entity bean and every bean instance corresponds to a particular table row.
The following are characteristics differentiating entity beans from session beans:
- Entity beans are retained after the end of a session, unlike session beans.
- Entity beans permit shared data access.
- Entity beans have a primary key or a unique identifier.
Techopedia Explains Entity Bean
The two different types of entity bean persistence are bean-managed and container-managed. An entity bean is persistent because it is stored in a relational database, where data exists after a session ends.
Multiple clients may share entity beans. Entity transaction management is important because at any given time, different clients may need to access and change the same data. Each bean’s transaction management is provided by the Enterprise JavaBeans (EJB) container, which guarantees data integrity.
Each entity bean is identified by a unique object identifier, which is used by the client to locate a specific entity bean.
Entity beans may be used when a bean is a business object and not a method. For example, a bank account is a business object, whereas bank account verification is a business method. An entity beam may also be used if a bean’s state should remain persistent.