• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unidirectional relationship

 
Kelly Wood
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the HF book, p432 q4:

Given the container-managed unidirectional relationship:

Foo(0-1) -> Bar(0-1)

and the object relations:

f1->b1
f2->b2

What will be true after the following code runs?

f2.setBar(f1.getBar())

The model solution states 'b2.getFoo()==null' as one of the correct answers. But given that Foo and Bar are in a unidirectional relationship where Bar is even aware of the relationship, isn't it true that the b2.getFoo() method does not exist? In the DD, we would not declare <cmr-field> for the Bar part. So how can the method getFoo() be called on b2?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic