• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

HF EJB question 4 on page 426

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone explain why option B is correct? Since the relationship is uni-directional, how come we can go from Bar to Foo by calling b2.getFoo()?
Thanks.
 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that the question contains a mistake and that you shouldn't be able to call b2.getFoo() on the Bar bean because if you don't have a cmr-field-name of Foo for the Bar bean, then you should not have an abstract method getFoo() for the Bar bean.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm glad somebody elss agrees with me on this one. I'm going to report it to booktech@oreilly.com, because it's still not in the official errata list.
 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I remember this one. I agree with you, too.
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The answer is correct. Don't let the unidirectional thing blurry your judgement. Look at the cardinality. A bar can have atmost only one foo.
After the operation, f2 is connected to b1.
If B is a wrong answer ( which is not) then b2 is still connected to some foo. What foo is that? The operation has left both f1 and b2 without any partner.
Hope it helps.
- walk rustin
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Walker,
Can you elaborate? I currently, agree with everyone else that there is no method b2.getFoo() since it is unidirectional but would like to hear more of your arguement.
Are u saying there is a be.getFoo() which returns the comp object for Foo? If so, how do you account for the relationship being unidirectional?
-Van
reply
    Bookmark Topic Watch Topic
  • New Topic