Characteristics of Entity Beans

Entity beans typically have the following characteristics:

  • Provides an object view of data in the database. For example, as shown in Figure 8.1, the StudentEJB enterprise bean instance provides an object view of a record in the student table in the database. The EJB container transparently synchronizes the data between the server's memory and the database.

    Figure 8.1. An entity bean provides an object view of data in the database.

  • Represents long-lived data. Its lifetime is the same as data in the database. The data of entity beans survives a crash of the EJB container.

  • Allows shared access by multiple users.

  • Just as a relational database has the concept of a primary key, its primary key identifies an entity bean. A student entity bean, for example, might be identified by a student ID.

  • As with a table in a relational database, an entity bean may be related to other entity beans. For example, as shown in Figure 8.2, in a college enrollment application, StudentEJB and CourseEJB would be related because students enroll in classes. This is an example of many-to-many bidirectional relationship.

    Figure 8.2. An entity bean can be related to other entity beans.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.226.255