O'Reilly logo

Sams Teach Yourself EJB in 21 Days by Krishna Kothapalli, Ragae Ghaly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required