SET AS HOME PAGE

ADD TO FAVORITES / BOOKMARK THIS WEBSITE (More Details)

Introduction

Servlet

Jsp

Security

Enterprise Beans

Contact Us


Entity Beans

 Introduction

An entity bean represents a business object in a persistent storage mechanism. Some examples of business objects are customers, orders, and products. In the Application Server, the persistent storage mechanism is a relational database. Typically, each entity bean has an underlying table in a relational database, and each instance of the bean corresponds to a row in that table.
Types of Enterprise Beans are
  • Session Beans
    1. Stateless Session Beans
    2. Stateful Session Beans
  •  Entity Beans
    1. Bean Managed Persistent (BMP) Entity Beans
    2. Container Managed Persistent (CMP) Entity Beans
  • Message-Driven Bean

 An entity bean

  • Represents persistent data stored in a storage medium, such as a relational database.
  • Persists across multiple sessions and can be accessed by multiple clients.
  • Acts as intermediary between a client and a database.
  • Stores database information temporarily for the client to work on. It then transfers the client-modified information back to the database.
 Characteristics of Entity Beans

  • Persistence: An entity bean is persistent in that its state exists even after a client stops accessing an application.
  • Shared Access: Multiple clients can share one entity bean by using separate instances of the entity bean. (When multiple clients access the same data, the modifications made by one client, if not updated in the database, will result in data inconsistency being accessed by other clients. EJB container is responsible for preventing the data from becoming inconsistent and maintaining data consistency by synchronizing the entity bean instances with the database)
  • Primary Key: Each entity bean has a unique identifier associated with it, known as primary key. A client uses the entity bean’s unique identifier in order to access a specific entity bean for performing operations. (For example, in an account entity bean the account number attribute represents the primary key as it can uniquely identify an account)
 Types of Entity Beans

  • Bean-managed persistent (BMP) entity bean: Contains the code to perform operations on the data stored in a database. You can change the code to reflect changes in the database or user requirements.
  • Container-managed persistent (CMP) entity bean: Uses EJB container to perform persistence operations. A CMP entity bean is independent of the database.

 Click for Next Topic
<- PREVIOUSNEXT ->