Many to many relationship

0
How to handle many to many relationship ?
asked
3 answers
3

For me, it's a really really tricky question and during application development I am always asking this question to myself before starting.

 

Should I use direct many-to-many relationship or creating an intermediate entity to manage the relationship.

This decision is fundamental because it affects the entire structure of your data model and the capabilities of your application.

A direct many-to-many relationship is simpler and works well for basic connections between entities. However, an intermediate entity offers more flexibility, allowing you to store additional information about the relationship itself.

For example, if you're connecting 'Students' and 'Courses', a direct many-to-many might suffice if you only need to know which students are in which courses. But if you need to store information like enrollment dates or grades, an intermediate 'Enrollment' entity would be necessary.

Making this decision early is crucial because it's often difficult and time-consuming to change later in the development process. It requires careful consideration of both current requirements and potential future needs of the application.

This is my perspective of this relationship.

I hope it will help you.

answered
1

Can you elaborate on this a bit more? Many to many associations can be defined by changing the properties of the association

image.png

But is is important to understand your use case to give you an advice on navigability and/or alternative (information entity). Some useful information can be found in the Rapid Developer Learning Path, specifically module 5.3

answered
0

Don't forget about the implications on performance when using a many-to-many association. It means that one (or both) entities at ends of the association will be the owner of the association and that could have impact on performance. See: https://academy.mendix.com/link/modules/371/lectures/3012/4.3-Tell-Me-More-About-Your-Relationship

answered