To retrieve C by retrieving A from the passed object B and then C from the retrieved non persistent object in the java code can be done by the code below:
// BEGIN USER CODE
List<IMendixObject> listA =Core.retrieveByPath(getContext(), objB.getMendixObject(), "MyFirstModule.A_B");
if(listA.size() >0){
List<IMendixObject> listC = Core.retrieveByPath(getContext(), listA.get(0), "MyFirstModule.A_C");
if(listC.size()>0){
return listC.get(0);
}
}
else{
return null;
}
return null;
// END USER CODE
First a retrieve by path is done following the path from B to A. This will return a list of A objects. Then using the first object from this list the retrieve by path is triggered to retrieve C by the A_C path. Then the code returns the C object. In your code you are trying to access the association directly from the metaobject, this is not possible.