• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

unidirectional relationship

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Oh the stink of it! Smell my tiny ad!
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic