Of the four associations Onetoone,onetomany,manytoone and Manytomany, only Onetoone, Onetomany, and Manytomany have mappedby attributes in relation to each other.
The following is an explanation of the Mappedby attribute in the Java doc:
The field that owns the relationship. Required unless the relationship is unidirectional.
Translated into Chinese is:
Domains that have association relationships are not required if the relationship is one-way.
So what does it mean to have an association, so to say that the assumption is one-to-one, then the party that owns the relationship has the ability to establish, release, and update the relationship with the other, and the other side has no, only passive management; in two-way, multi-and bidirectional many-to-many is a meaning.
Since jointable and joincolumn are generally defined at the end of the owning relationship, and Hibernate does not allow Mappedby to be defined with jointable and Joincolumn, Mappedby must be defined in the owning party of the relationship, The owned side, which is a party that defines jointable and Joincolumn mutexes, points to a field in the owning party about the owning party, possibly an object (Onetomany), or a collection of objects (Manytomany).
The owner of the relationship is responsible for maintaining the relationship, establishing a foreign key in the relationship owner, so both jointable and joincolumn are defined in the relationship owner.
Another feature of Mappedby is that after adding this attribute, you can avoid automatically generating intermediate tables.
Finally, mappedby= "xxx", so to understand, Mappedby defined in the relationship of the owner, the mappedby definition of the class (either a single or a collection form) on the relationship owner of the name of the party is "xxx".
Mappedby Properties for JPA Onetoone,onetomany and Manytomany