• 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
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

HFEJB mock question, Page 367  RSS feed

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!