JPA associations implementation difference in bidirectional and uni directional
I have two Model classes.I am trying to make those two classes with associated classes.
When I explored the implementation , I read that these association can be bidirectional or uni directional.
Bidirectional entity class containing association annotations in both class and in the case of uni directional association annotation is only in one class.
So when I am going to make associated classes for relation, How I will identify or decide where I need to use bidirectional implementation and where I need to use uni directional ?
What is its implementation deviation? Can anyone help me to identify this??
Lets take an example where in one entity A is mapped to many entity B
If you will be fetching data for/querying from entity A and wont ever need to fetch from entity B the going for unidirectional One-to-Many mapping makes sense.
But if you would be querying from entity A as well as from entity B it is recommended to go for bidirectional One-To-Many