Chapter 4. Object/Relational Mapping

Entities do not exist in isolation and are usually associated with other entities. In this chapter we examine how to map these associations onto a relational database. We will cover the following topics:

  • One-to-one, one-to-many, and many-to-many associations.

  • Default object/relational mapping values.

  • Overriding the default object/relational mapping values.

  • The @Embedded, @Embeddable, @Enumerated, and @MapKey annotations.

  • Composite primary keys

  • Entity inheritance mapping strategies

O/R Mapping Default Behavior

In the previous chapter we saw how to persist individual entities to a relational database. In this chapter, we take a further look at object-relational mapping with EJB 3. In any real world application, entities ...

Get EJB 3 Developer Guide 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.