Associations between Persistable and Non Persistable entity

0
How many associations are there between persistable and non persistable entity in Mendix?
asked
5 answers
7

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 

answered
2

Hi,

 

Are you Start your association from non persistable entity ?

 

Regards,

Rasik.N

answered
1

I tried to give 1-1 association between persistable and non persistable entity but it throws error

as below . When to resolve error I tried to make owner as Default then the association changes to 1 – * automatically.

answered
0

Check the answer of Oswaldo Valles:

 

Reason why NPEs association to PE cannot be (1 - 1)

answered
-2

HI Satyam,
There are 3 types of association in Mendix 1 – 1, 1 – *, and * – *. You can use all three between Non-persistable and persistable Entities.  But you have to make sure all the association should start from Non-Persistable to Persistable.

 

This will be different when the Same Entities are used for the Native application and the error will appear in the errors pane of your Studio pro.

answered