• 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:

HFEJB mock question, Page 367

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All, I got a question about mock question in HFEJB, Page 367,
Question 1:
What's true for a bean provider when creating an entity bean using container-managed persistence? (Choose all that apply).

A. Container-managed persistent fields must be defined in the entity bean class.
B. Container-managed relationship fields must be defined in the entity bean class.
C. When implementing a one-to-many relationship, the java.util.List interface must not be used.
D. Accessor methods for container-managed relationship fields must be exposed in the bean's remote component interface.

The answer given by the book is: C. But why A, B is not right?
(I know as for option C. Only collection or Set can be used, so C is right,
as for option D, should be local component interface, not remote component interface. Why A, B are not right? )


Please help me clarify this question?

Thanks a lot.
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Hai Lin:
Hi All, I got a question about mock question in HFEJB, Page 367,
Question 1:
What's true for a bean provider when creating an entity bean using container-managed persistence? (Choose all that apply).

A. Container-managed persistent fields must be defined in the entity bean class.
B. Container-managed relationship fields must be defined in the entity bean class.
C. When implementing a one-to-many relationship, the java.util.List interface must not be used.
D. Accessor methods for container-managed relationship fields must be exposed in the bean's remote component interface.

The answer given by the book is: C. But why A, B is not right?
(I know as for option C. Only collection or Set can be used, so C is right,
as for option D, should be local component interface, not remote component interface. Why A, B are not right? )


Please help me clarify this question?

Thanks a lot.



Bean provider only defines abstract set/get methods. Container will generate actual implementation that will have CMP/CMR fields definitions. So it is container's responsibility.

Vitaliy
 
Hai Lin
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vitaliy,
If based on what you said, Bean provider only provide the abstract getter/setter, then why in HFEJB, Page 318, Complete code for the CustomerBeanCMP class, the bean proveider also gave us the concrete implemtation of all the abstract getter/setter?

Waiting for your reply.

Thanks a lot.

Hai
 
Vitaliy Geraymovych
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Hai Lin:
Vitaliy,
If based on what you said, Bean provider only provide the abstract getter/setter, then why in HFEJB, Page 318, Complete code for the CustomerBeanCMP class, the bean proveider also gave us the concrete implemtation of all the abstract getter/setter?

Waiting for your reply.

Thanks a lot.

Hai



Hai,

Check out page 316 for a good explanation. Look specifically for notes on the right.

Vitaliy
 
Hai Lin
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vitaliy,
Thanks a lot. I got it.
Normally, we only put abstract getter/setter for the bean, but it's also allowed if we put concrete getter/setter, though it's not good idea.

Hai
 
Drove my Chevy to the levee but the levee was dry. A wrung this tiny ad and it was still dry.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic