Entity association retrival question

0
Hi, New to Mendix, If a retrieve an object A,  the association B is not auto retrieved, right? If i do anohter retrival to get the associated object B, is it auto linked so now i  can do A.getB()? meaning i can just pass A and B is passed also.   Thanks Shannon
asked
3 answers
0

 

Associated objects are not auto retrieved in Mendix. The associations themselves, which are actually stored in a separate table as well, so in your example A_B, are.

I see you are talking in Java method terms; even though Mendix is based on Java, those get methods are not to be used when Modeling. Use retrieve activities in your Microflows, best explained in the beginner tutorials Mendix has to offer.

answered
0

To Ivo's point, the mendix learning paths explain this pretty well. Here is a link to the online training.

https://gettingstarted.mendixcloud.com/

 

In regards to your question. In this case you would retrieve object A using the retrieve activity (most likely with source "from database"). Once you have object A, you can use another retrieve activity but this time with source "retrieve by assocation" to get the associated object B. 

 

Edit:

 

In a java you can use "RetrieveByPath"

Here is the runtime documentation that explains it more

https://apidocs.mendix.com/7/runtime/

 

and heres another post about this. This was referring to Mx5, so i linked the mx7 api documentation

https://forum.mendix.com/link/questions/8128

answered
0

Thanks, i will check the learning paths. 

I was asking in the context of a java action, if i can just pass A or have to pass both A and B.

 

answered