Retrieve child objects by association - Self association

1
I have a entity with self-association that have an object of the same entity as its parent or children. I do not want to commit changes on this entity. I would like to retrieve a list of children objects associating from parent entity. Using association I am able to retrieve single parent object not a list of children's. Whereas using retrieval from the database I am able to retrieve a list of children's. Could you please suggest me a way to retrieve a list of child objects using association not from the database.
asked
3 answers
1

I think this might be possible in Java, just not directly in a microflow. The documentation for core.retrieveByPath says:

retrieveByPath(IContext context, IMendixObject mxObject, String path, boolean isSelfAssociationChild)

Retrieves objects using the given object and path.

I haven't tested it, but that boolean would seem to indicate that you could "reverse" the self-association while retrieveing.

answered
0

Pranay,

Please see this article for a walk through on how to do this. While it is for Mendix 5 - this approach has not changed in version 6.

Mike

answered
0

What I did in the same situation was create a dummy entity instead of a self-reference.

See also this forum post :

What I did now is, I added a second, dummy, entity. This dummy entity has a 1..* relation AND a 1..1 relation to the main entity. Basically, this is the same as a direct recursive relation, but now I have 2 relations to the main entity

answered