JPA : 1-N Relationships

You have a 1-N (one to many) when you have one object of a class that has a Collection/Map of objects of another class. In the java.util package there are an assortment of possible collection/map classes and they all have subtly different behaviour with respect to allowing nulls, allowing duplicates, providing ordering, etc. There are two ways in which you can represent a collection or map in a datastore : Join Table (where a join table is used to provide the relationship mapping between the objects), and Foreign-Key (where a foreign key is placed in the table of the object contained in the collection or map.

We split our documentation based on what type of collection/map you are using.