• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

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: 3036
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
 
When it is used for evil, then watch out! When it is used for good, then things are much nicer. Like this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic