21.5. Bean Relationships

An added wrinkle to container-managed persistence is the idea of container-managed relationships (CMR). Because we are modeling only a single entity bean, there aren't any relationships to be considered. If we were to convert other classes to entity beans, however, it would then be necessary to describe how these entity beans are related to one another. Relationships may be characterized as one-to-one, one-to-many, many-to-one, or many-to-many; they can also be further categorized as unidirectional or bi-directional.

For example, if we were to create a Team entity bean, then we would want to describe the relationship between the Team and Game objects using CMR. What is being described is a physical relationship—what data ...

Get J2EE™ and JAX™: Developing Web Applications and Web Services 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.