A mapping type classification
1 one-to-many
2 Many-to-one
3 One-to-one
4 Many-to-many (many-to-many)
Two-to-many mapping introduction
1 life example
2 Specific methods
In the database, a one-to-many relationship can be expressed by adding primary and foreign key associations.
In Java code, it is implemented by one party holding multiple parties, that is, using the <set> element in the "one" side to represent the object that holds the "many" side.