Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization forum!
  • 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
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

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
 
Did Steve tell you that? Fuh - Steve. Just look at this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!