Menu Close
Settings Close

Language and Page Formatting Options

Chapter 7. Association Mappings

7.1. Introduction

Association mappings are the often most difficult thing to get right. In this section we'll go through the canonical cases one by one, starting with unidirectional mappings, and then considering the bidirectional cases. We'll use Person and Address in all the examples.
We'll classify associations by whether or not they map to an intervening join table, and by multiplicity.
Nullable foreign keys are not considered good practice in traditional data modelling, so all our examples use not null foreign keys. This is not a requirement of Hibernate, and the mappings will all work if you drop the nullability constraints.