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

ejb-ref tag in the DD contains any redundancy?

 
Nesan Krish
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The <ejb-ref> tag in the DD contains <ejb-link> tag, which describes a bean fully including its home and component interfaces. Then why the <ejb-ref> tag should contain <home> and <remote> tags? In my view it is unnecessary, but am I correct? Please advice me! Thanks in advance!!
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The nested elements in the ejb-ref element specify interfaces to use for local/remote home/component interfaces. There is no redundancy.
 
Nesan Krish
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am still confusing!
The details of the home and component interfaces of the bean are included in the <ejb-link> element:
Because what is given in the <ejb-link> element is what has already been given in the <ejb-name> element someware in the DD where home and component interface details have also been given in <home>, <remote> or <local-home>, <local> elements.
Then why these details are repeating again in <ejb-ref> element?
Any further explanations greatly appreciated! Thank you very much.

[ May 02, 2004: Message edited by: Nesan Krish ]
[ May 02, 2004: Message edited by: Nesan Krish ]
 
Namitha karupaiya
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the <ejb-ref> element the bean provider gives new client views for the bean stated in <ejb-link> element.
 
Nesan Krish
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then, is it posible for a bean class to have multiple client views?
 
Praveena Venigalla
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
---------------------------------------------------------------------------
The details of the home and component interfaces of the bean are included in the <ejb-link> element:
Because what is given in the <ejb-link> element is what has already been given in the <ejb-name> element someware in the DD where home and component interface details have also been given in <home>, <remote> or <local-home>, <local> elements.
Then why these details are repeating again in <ejb-ref> element?
----------------------------------------------------------------------------
In order for an enterprise bean to access another bean, the bean provider declares an EJB reference in the deployment descriptor for the home interface of the enterprise bean to be accessed. The EJB reference is given a logical name that is relative to the "java:comp/env" context. Additional information regarding the type of bean, the class names of the home and remote bean interfaces are also provided. The EJB reference in the deployment descriptor allows the application assembler and deployer to discover all references used by the enterprise bean. The deployer then binds the declared EJB reference to the enterprise bean home in the target environment. This layer of indirection allows the bean provider to look up the referenced bean's home interface using the logical name without knowing where the object resides in the enterprise system.

Shortly: <ejb-ref>tag is written by bean provider...for referencing bean1 from bean2.. He also provides the home,remote and type of bean used.So that application assembler can link the bean easily by seeing the home,remote interfaces used by bean provider.
Afterwards app.assembler or deployer links this bean2 with bean1 by providing <ejb-link> element in the deployment descriptor.
Hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic