NSTableView and Core Data

I have 2 entities, entity A and entity B. Entity A has a many-to relation ship with B. I have 2 table views, in the first it displays all entities A. When one entity A is selected I want the other table view to display the contents of the relationship that A has with B, so all of the entities B that are in the Relationship set of A should be displayed. How would I go about doing this.