Types of Associations

1
Hi Experts, Hope you are doing Good! Can you please advise how many types of associations can we have between Non persistable and persistable entities in Mendix?   Regards, Malay
asked
1 answers
2

Hi,

An association between a Non-persistable and persiatable must start in the NPE.

Mendix handles the associations as follows

  1. an object of the owning entity (the entity where the association starts with a dot) contains a member storing the ID of the referenced object(s)
  2. When storing in the database a join table will store the ID's of the  referenced records. So when you do have an association between a car and a model entity, ther will be a join table IDCar-IDModel. 

Knowing this, when you have an association between a NP and NPE it must start (dot) at the NPE otherwise the owning entity is the persitable entity. which would result in a join table which stores ID's of objects which will never enter the database. Hence a non-persitable entity cannot be persisted.

 

Long story short; only association that start in a NPE can be used. A 1-1 association results in ownership at both sides and cannot be used between a NPE and PE 

Hope it helps!!

answered