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.
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
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.