• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt on ejb-ref tag..

 
Narasimha Rao B.
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is it necessary to define the bean in <ejb-ref> tag, when ever i am referrring the bean? Is for cmr fields also?
I am sure the above two questions might not be understandble, hence i am explaing with the examples..
I am having the MovieBean, DirectorBean.
In the MoviewBean, i am having <cmr-field> on DirectorBean.
In the MovieBean to set the DirectorID(which is primary key of DirectorBean), i will query the jndi lookup for DirectorBean home from that i will get the DirectorBean EJB Object and will use the same to set DirectorID.
Now my question is to refer the DirectorBean from MoviewBean -- Is it necessary to refer the DirectorBean in <ejb-ref> of DD of MovieBean section or not.

Thanks in Advance,
 
Nitin Mehhta
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No it is not necesary to use the ejb-ref tag in the case you have mentioned. It is just a way for the developer to use the reference of a bean even if he/she does not know the actual JNDI name of the referenced Bean. Like in your example if you want to access DirectorBean from MovieBean and you don't know the JNDI name of the DirectorBean then you can use the JNDI name "java:com/env/ejb/Director" and in your deployement descriptor you can mention in the MovieBean - <ejb-ref><ejb-ref-name>ejb/Director</ejb-ref-name></ejb-ref>

Later on the Application assembler can insert the tag <ejb-link>DirectorBean</ejb-link> in the ejb-ref tag.

I hope i'm clear.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic