O'Reilly logo

Java™ Oracle® Database Development by David J. Gallardo

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

Class Relationships and Persistence

One of the strengths of JDO is that it supports the persistence of related classes transparently. As mentioned previously, this lets us develop object models in Java as we normally would without having to make any special concessions for persistence.

There are two types of class relationships in Java:

  • Inheritance— One class is a subclass of another

  • Composition— One class contains another

Composition and Aggregation

Of the two types of class relationships, composition is the most common. Composition can take many forms; it can represent one-to-one relationships between classes, one-to-many relationships, and many-to-many relationships. The latter two cases, where the composition involves a collection, are also ...

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