The relationships that would be annotated are the four types that you have in relational data model:
- One-To-One annotated with @OneToOne
- Many-To-One annotated with @ManyToOne
- One-To-Many annotated with @OneToMany
- Many-To-Many annotated with @ManyToMany
If concepts like Cardinality, Direction of Relationship, Cascades, Owning side and Inverse side of Entity relationship is new to you, then it is would be good to first read Understanding Entity Relationship Mapping, Part 1: The basic concepts
The relationship would be classified into two: Single Valued Mappings and Collection Valued Mappings. It is worth stating that the examples were written with Hibernate's implementation of JPA in mind, but would work with any other standard implementation of JPA 2, as no Hibernate specific annotation is included.
So let us begin.