• 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
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

QNo. 4 Ch-6 Coffee Cram Mock Exam!!

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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());

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.

Please help me on this.

Thankz,
Puneet
 
Sheriff
Posts: 3064
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's actually chapter 7, question 4. You may have a error in your printing that's been fixed in mine. Mine shows that A is the only correct answer.
 
Puneet Vashisht
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thankz greg,

i'm assuming that it is an printing error then, because the option cant be correct anywayz..

thankz
puneet
 
It would give a normal human mental abilities to rival mine. To think it is just a tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic