It's not a secret anymore!*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes HFEJB mock question, Page 367 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "HFEJB mock question, Page 367" Watch "HFEJB mock question, Page 367" New topic
Author

HFEJB mock question, Page 367

Hai Lin
Ranch Hand

Joined: May 23, 2004
Posts: 79
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.
Vitaliy Geraymovych
Greenhorn

Joined: Jun 15, 2004
Posts: 24
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


SCBCD 1.3<br />SCJP 1.2<br /> <br />"Every time I learn something new, it pushes some old stuff out of my brain" H.Simpson
Hai Lin
Ranch Hand

Joined: May 23, 2004
Posts: 79
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

Joined: Jun 15, 2004
Posts: 24
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

Joined: May 23, 2004
Posts: 79
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
 
GeeCON Prague 2014
 
subject: HFEJB mock question, Page 367