Chapter 8. Developing Entity Beans

This chapter is for is the Enterprise Bean provider; that is, the person in charge of developing the software components on the server side, and more specifically the Entity Beans.

NoteNote
 

In this documentation, the term "Bean" always means "Enterprise Bean."

8.1. Introduction to Entity Beans

An Entity Bean is comprised of the following elements, which are developed by the Enterprise Bean Provider:

NoteNote
 

According to the EJB 2.0 specification, the "Component Interface and Home Interface" can be either local or remote. Local Interfaces (Home and Component) are to be used by a client running in the same JVM as the EJB component. Create and finder methods of a local (or remote) home interface return local (or remote) component interfaces. An EJB component may have both remote and local interfaces, even if normally only one type of interface is provided. If an Entity Bean is the target of a container-managed relationship (refer to EJB 2.0 persistence), then it must have local interfaces.

These elements are described in the following sections.

An Entity Bean represents persistent data. It is an object view of an entity stored in a relational database. The persistence of an Entity Bean can be handled in two ways:

Currently, the platform handles persistence in relational storage systems through the JDBC interface. For both container-managed and bean-managed persistence, JDBC connections are obtained from an object provided at the EJB server level, the DataSource. The DataSource interface is defined in the JDBC 2.0 standard extensions (see http://java.sun.com/products/jdbc/). A DataSource object identifies a database and a means to access it via JDBC (a JDBC driver). An EJB server may propose access to several databases and thus provides the corresponding DataSource objects. DataSources are described in more detail in Chapter 4 Configuring JDBC DataSources.