13.6. Example: the BikeModel EJB

13.6.1. Overview

BikeModel is an EJB that represents a particular model of motorcycle. It stores persistent information about the type, engine size, cost, and a general description. The name of the model is the primary key for this EJB.

The Bike EJB models an individual motorcycle of a particular model. In the case study, Bike has only one property: licenceNumber, that is, its license plate number (‘registration number’). In reality, of course, we may need to store more than this.

The relationship between BikeModel and Bike is one-to-many, navigable in the direction BikeModel to Bike (Figure 13.3).

Figure 13.3. BikeModel and Bike, and the relationship between them.

In the design adopted, Bike is a dependent ...

Get Applied Enterprise JavaBeans™ Technology now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.