* to 1 association with owner being the 1

1
Hi,   I was wondering why it is not possible to have the ownership of the association on the ‘1’ side in * to 1 associations. Of course one way to change this is to use a * to * association where the ownership can be set to the desired entity. However, in terms of my data model structure, this is not correct, and for component entanglement reasons I want the ownership to be at the '1’ side.   In other words: I want to have the ownership of this association at B without leaving the * to 1 structure.  
asked
2 answers
1

“I want to have the ownership of this association at B without leaving the * to 1 structure.” That is not possible in Mendix because of the way Mendix uses the ownership when creating a “reference selector” and a “reference set selector”. If you want to get a better feel on when, how, what these references result in:

- add Entity C having *-* to entity B

- rightclick an entity and “Generate overview pages” for the three of them.

- on A_NewEdit you can choose one B

- on C_NewEdit you can choose multiple Bs

- on B_NewEdit you can choose multiple Cs, but no As and that is where Mendix falls short. It would be nice and useful to also be able to select As. The reason is that B, when selecting As, cannot see which As are already connected to another B.

 

 

answered
2

I you picture a 1 to many association as a Parent (1) to her Children (M), the child has only one parent (i.e. owns the association), but the parent can have many children and so cannot own the relationship(s) to children.

 

Put in Mendix terms, if you picture a page with a dataview and a reference selector in that dataview (for a 1 to many relationship):

  • if the dataview contains a Child object, you can point the reference selector to the Parent entity since there can only be one Parent for each Child
  • if the dataview contains a Parent object, a reference selector won’t work because you can only select one Child for the Parent with a reference selector.  However, the Parent may have more than one Child
answered