2.13.8.6. Bidirectional Mapping

Bidirectional Relations introduced bidirectional relations. To map a bidirectional relation, you map one field normally using the annotations we have covered throughout this chapter. Then you use the mappedBy property of the other field’s metadata annotation or the corresponding mapped-by XML attribute to refer to the mapped field. Look for this pattern in these bidirectional relations as you peruse the complete mappings below:

  • Magazine.publisher and Company.mags.

  • Article.authors and Author.articles.