Entity Bean Views and the UML

Structurally, entity beans consist of a main Java class, often called the implementation class or the entity bean class, and two interfaces: Home and Remote. It also has a primary key class that contains methods for operating on the primary key for a single database table, or some compound set, depending on the data the EJB is intended to represent. The relationships between these items, as well as the particular J2EE base objects these items extend and implement, give the entity bean its particular functionality and usefulness as an EJB component.

Entity beans, like all EJBs, make use of a deployment descriptor to hold additional information pertaining to the component. This includes transaction settings on business methods, relationships with other entity beans, persistent field settings, and so on.

Let's take a look at the different views an entity bean has. We'll dive into the technology details thereafter to further explain these views.

Client View

The client view of an entity bean includes everything the client can call directly, which consists of the Home and Remote interface and the primary key class. As discussed in the previous chapter, in a UML class diagram, we represent the client view of an entity bean via a UML subsystem. An example is shown in Figure 13-2.

Figure 13-2. Full client view representation of an entity bean in a UML class diagram


An advantage of using the subsystem approach is the ability to expose those aspects that are of particular relevance in a specific situation or hide irrelevant details. Figure 13-2 provides an example of client view elements inside the subsystem. Note the specific stereotypes shown on the different elements. The stereotypes indicate that the UML constructs have been extended in their meaning to support special needs of the J2EE architecture. Such stereotyping also offers a simple and compact means of identifying the specific role played by a specific model element that is part of an EJB. The compact client view representation is shown in Figure 13-3.

Figure 13-3. Compact client view representation of an entity bean in a UML class diagram


Internal View

The internal view of an entity bean includes all components of the client view, the implementation class and its associated relationships, and any additional classes users add to the design of their entity bean. In a UML class diagram, these components appear as normal classes and interfaces.

The internal view is useful if you are interested in the details of the implementation. For example, the developer of the entity bean might find the internal view appropriate. However, aside from the additional details visible, the internal view is essentially equivalent to the client view of the entity bean, as shown in Figure 13-4.

Figure 13-4. Internal view representation of an entity bean in a UML class diagram.


Let's now spend some time digging through the technology aspects of 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.135.248.37