Introduction
Bidirectional association allows us to obtain data about a dependent object from both sides. In these situations, we have two classes referencing each other.
Consider Employee and Address classes, where Employee has a reference to Address and Address has a reference to Employee. One-to-one or one-to-many relationships for the classes like these in the mapping file in hibernation are known as bidirectional associations.
Directions in Entity Relationships
A relationship's direction might be bidirectional or unidirectional. There is an owning side and an inverse side to every bidirectional interaction. A unidirectional relationship has just one side that owns. The owner of a relationship controls how the Persistence runtime changes the relationship in the Database.
Unidirectional Relationships
Only one entity in a unidirectional relationship has a relationship field or attribute that relates to the other. LineItem, for example, has a connection field that identifies Product, but Product does not have a relationship field or attribute that identifies LineItem. In other words, LineItem is aware of Product, but Product is unaware of which LineItem instances are referring to it.
Bidirectional Relationships
Each entity in a bidirectional relationship has a relationship field or attribute that references the other entity. An entity class's code can access its linked object via the relationship field or property. An entity is said to "know" about its associated object if it has a related field. They have a bidirectional relationship like if Order knows what LineItem instances it has and LineItem knows what Order it belongs to.





