This is one-to-many, that is, one MERs corresponds to multiple orders
The following is one-to-one:
Important configurations:
1. Inverse is the opposite. It means that this association is controlled by the other party, that is, the other party of the queue.
inverse="true"
2. Lazy indicates whether to delay loading. It is loaded only when needed, and does not need to be loaded.
After the session is turned off, we cannot load it any more.
Is common: org. hibernate. lazyinitializationexception
In this case, we set lazy to false.
Lazy has two configuration methods:
1) Configure in sequence-to-one or set:
<set name="orderses" inverse="true" cascade="save-update" lazy="true">
On one side, lazy has three values: false, true, and extra. The default value is true.
Delayed loading has a great advantage, saving SQL statements.
On the worker side, lazy has three values: false, proxy, and no-proxy. Note that the true option is not available here.
Generally, when querying the region side, it also queries the one side.
2) Configure in class:
Lazy on the class only works for common attributes, and does not work for any set or list, so the set and others need to be written again.