Implementing Container-Manager Relationships
In this section, we examine the sample implementations of different kinds of relationships. Later today, we'll design and implement a complete example of one-to-many bidirectional relationship between order and line items.
Implementing One-to-One Relationships
Figure 12.1 shows a StudentEJB entity bean with a one-to-one unidirectional relationship to an AddressEJB entity bean. Student-Address is the name of the relationship. Student-has-address is the role name of the StudentEJB, and Address-belongs-to-student is the role name of the AddressEJB in this relationship.
Figure 12.1. One-to-one unidirectional relationship.
The following code snippet shows the implementation of the relationship in Figure ...
Get Sams Teach Yourself EJB in 21 Days 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.