How should I set up the Associations?

I want a Drink to have multiple IngredientsSelect. How should I set up the Associations?     Is it correct to set it up like the picture?
3 answers

Hello Jeff Yu,


It depends what the scenario is, but I think that some drinks will make use of the same ingrediënts for example, water, sugar, salt and others.


So it needs to be at least many-to-many, but because many to many relationships are not that stimulated in mendix because of the extra tables, way of retrieving, performance etc.


You can maybe achieve it by creating an inbetween couple entity, like they do in this learning path with registrations:




For you this means that you create an RecipeIngredientLine benefit of this is that you can add the measurements on that entity as well, so for example sugar 50 mg salt 5 mg etc.


Hope this helps,


Good luck!


Hi Jeff,

If you have a requirement of 1 Drink have Multiple IngredientsSelect means then the above association which you have mentioned was correct.


Hi Jeff!

That's the correct way for sure. In that case a drink can have multiple ingredients. The IngredientesSelect is the owner of the association, so the association is gonna be set through that object. You can check how the ownership works here: here:


Kind regards.