Create a 1-* association and make 1 the owner of it.

0
Is it possible to add a 1 to many association from one attribute to another, so that 1 is the owner of it? Use case: Booking time slots, entity “Reservation”. A reservation in a calendar should refer to multiple instances of “Order” (a list of orders basically) but an order should only refer to one reservation. I already considered if I could need a many to one association from Order to Reservation and then a 1 to 1 from Reservation to Order to achieve this? Is that true or does it work on an easier way?
asked
1 answers
0

Hi Max,

 

Take a look in this learn path → https://academy.mendix.com/link/modules/203/lectures/1577/2.3-Players-and-Captains

 

Its a similar case:

When you have 1-* association between entities and want to know the current Order, you may opt to have a 1-1 association to set it.

In Mendix each association is like a attribute in a class in traditional OOP / ORM.

( but Mendix will always generate a intermediate table and never a foreign key field ) 

 

 

So the answer is: Depends on your business rules to opt to have a new association 1-1 or extra attributes and more code behind to change it.

 

Best regards

answered