Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in Final Mock Exam of HFEJB

 
Sandeep Prabhakar
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Folks,
The final mock exam in HFEJB has this question.

Within the deployment descriptor's <ejb-local-ref> element, which elements are optional ? (Choose all that apply)

A. <local>
B. <ejb-link>
C. <local-home>
D. <description>
E. <ejb-ref-name>
F. <ejb-ref-type>

The answer given is B and D.
I feel that <ejb-link> is optional to Bean Provider but is not the same for Application Assembler.
So I gess the answer should be D.

Ranchers, Please let me know if this is correct.

Cheers,
Sandeep
 
Nishant Verma
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<ejb-link> : specified by application assembler **IS** optional.

<description> : specified by bean provider **IS** optional.

The question states what is **OPTIONAL**. Nothing more than that. So get the keywords right.
 
Sandeep Prabhakar
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nishant,
If that is the case, it would be an error if <ejb-link> is not specified. How does the container know which bean is the current bean referring to

Cheers,
Sandeep
 
Nishant Verma
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please note the usage of the <ejb-link> and without it. U will know.

<entity>
...
<ejb-ref>
<ejb-ref-name>ejb/Emp</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>EmpHome</home>
<remote>EmpRemote</remote>
<ejb-link>EmployeeRecord</ejb-link>
</ejb-ref>
...
</entity>


And without :

<session>
<ejb-name>EmployeeRecord</ejb-name>
<ejb-class>com.sandeep.TestEJB</ejb-class>
<ejb-ref>
bla bla bla, but no ejb-link
</ejb-ref>
...
</session>

Here "ejb/Emp" refers to EmployeeRecord in the **SAME** deployment descriptor. Hence you just created an alias for EmployeeRecord, rather than declaring actual descriptors.

Bottom-line

<ejb-link> = alias

Please credit $100 to my bank account
 
Sandeep Prabhakar
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ha ha ha. I feel that should credit me $100 for giving you a oppurtunity to explain this.
Anyways thanks.

Cheers,
Sandeep
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic