In Mendix there is a way to retrieve an associated object list, starting with the parent entity and using an association. For example, given the domain model below, I can retrieve the appropriate Mentor object and pass this object to a database retrieval with an xpath query of "//ModuleName.Manager[ModuleName.Manager_Mentor = $Mentor]". I'm looking for a way to do this in Java.In Java, I've found that the retrieveByPath method will only work I am starting retrieval from the child entity. E.G. retrieveByPath(context, Manager.getMendixObject(), Manager.MemberNames.Manager_Mentor). But I need to start from the parent, Mentor entity and retrieve the child, Manager entity. So I would like to do something like retrieveByPath(context, Mentor.getMendixObject(), Mentor.MemberNames.Manager_Mentor). However, there is no Manager_Mentor value stored in the MemberNames enumeration on the parent entity. Even when I pass the association name directly as a string (E.G. retrieveByPath(context, Mentor.getMendixObject(), "Module.Manager_Mentor") the call does not retrieve any objects, just an empty list.
I haven't listed my use case because it's out of scope and I'm not really looking for a workaround. I figure there must be some easy, exposed way to do this that I'm just overlooking in the API docs.
You can use the same method in java, retrieving the data via xpath.
See this method in th Core class:
public static java.util.List<IMendixObject> retrieveXPathQuery(IContext context, java.lang.String xpathQuery) throws CoreException
With the community commons module writing the xpath is even more simple and this makes use of the above mentioned method.