Reputation: 31568
I am getting a bit confused with uni-direction mapping and bir-direction mapping.
Suppose i have
class Organisation
That has many to many
association with country
.
So a country can have many organisations and organisation can belong to many countries
Now this should be uni-direction or bidirection from ORM point of view.
Because i want that when i create organisation. It should have select box for selecting country
But when i create country , then it should not always ask me to select organisation. But i do need to get the list of organisations in particular country.
So what should i do
Upvotes: 0
Views: 90
Reputation: 42114
Because it seems to be that you quite often need to navigate from the Organisation to collection of connected Country entitities and also to inverse direction, you need bidirectional relationship between these two.
Nature of many-to-many relationship is optional. When you create new instance of Country, you are not forced to select Organisation(s). Model allows you to do so, but it is not obligatory. Both Country and Organisation can exist without any connected entities.
Upvotes: 1