One-to-One Bidirectional Relationship
Learn how to make the one-to-one relationship bidirectional and resolve the JSON infinite recursion issue.
Right now, we have a unidirectional one-to-one mapping which means that if we have a Twitter account, we cannot find the name of the player who has that account. A GET request to /profiles
only gets the PlayerProfile
object and not the Player
it is associated with.
It is however possible to find the Twitter account, if we have the Player
entity. As can be seen from a GET request to /players
, the PlayerProfile
entities are also fetched.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.