Given the container-managed unidirectional relationship:
Foo(0-1) --> Bar(0-1)
And the object relations:
What will be true after the following code runs?
A. f1.getBar() == null B. b2.getFoo() == null C. b1.getBar() == null D. None of the above.
Correct Ans : (A,B) according to the book.
My question is if it is a unidirectional relationship how can b2 call getFoo() method. Meaning in a unidirectional relationship only one entity can references of other. That means if Foo has a getBar() method, then Bar cannot have a getFoo() method, if it has to be a unidirectional relationship. This can be verified at HFEJB PGNo. 391, where a unidirectional relationship is defined between Movie and Trailer. And only Movie cant get the Trailer references through getTrailer.