Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ejb-link element....

 
Vijay Govind
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Folks

GM. What'z the deal with ejb-link element? I know it is optional, but still something like that does not make sense. What this element can tell to anyone(container, developer, assembler, deployer)that is not told by the home, remote elements.

Thanks in advance.
Vijay

;
 
Mini Sarin
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ejb-ref element does not contain the name of the actual bean class. The ejb-ref-name tag refers to any fictitious name used by the bean provider. It doesn't contain the ejb-class tag.

The application assembler puts in an ejb-link tag to specify the name of the actual bean class which could be in the same ejb-jar or a different ejb-jar but in the same J2EE application.

The deployer will then look at the ejb-link element and bind the bean reference specified in ejb-link to the bean home.
 
Rajan Murugan
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mini Sarin:
The ejb-ref element does not contain the name of the actual bean class. The ejb-ref-name tag refers to any fictitious name used by the bean provider. It doesn't contain the ejb-class tag.

The application assembler puts in an ejb-link tag to specify the name of the actual bean class which could be in the same ejb-jar or a different ejb-jar but in the same J2EE application.

The deployer will then look at the ejb-link element and bind the bean reference specified in ejb-link to the bean home.


what do you exactly mean by

The deployer will then look at the ejb-link element and bind the bean reference specified in ejb-link to the bean home.


and how does this binding happen ?
 
Vijay Govind
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sarin:
First of all thanks and I get it. I was carried away by the "word" optional. Now I understand that it is optional for the Bean Developer, but propably a must for Deployer(like role-link element)

Rajan:
To answer your question, I believe the binding will happen as it happens to any other resource. The deployer might use a Container specific tool to handle this.

Folks:
Please correct me if I am wrong.
 
Rajan Murugan
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mini Sarin:
The ejb-ref element does not contain the name of the actual bean class. The ejb-ref-name tag refers to any fictitious name used by the bean provider. It doesn't contain the ejb-class tag.

The application assembler puts in an ejb-link tag to specify the name of the actual bean class which could be in the same ejb-jar or a different ejb-jar but in the same J2EE application.

The deployer will then look at the ejb-link element and bind the bean reference specified in ejb-link to the bean home.


The ejb-ref-name tag refers to any fictitious name used by the bean provider. It doesn't contain the ejb-class tag.


what will happen if ejb-class is absent.will it matter?

The application assembler puts in an ejb-link tag to specify the name of the actual bean class which could be in the same ejb-jar or a different ejb-jar but in the same J2EE application.


Isn't it the name of the bean (not the name of the bean class).

Lastly what will happen when ejb-link is not there.Isn't ejb-link optional.
 
Mini Sarin
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes the ejb-link tag contains the name of a bean whose class name will be in another element like this:

<entity>
<ejb-name>EmployeeRecord</ejb-name>
<home>com.wombat.empl.EmployeeRecordHome</home>
<remote>com.wombat.empl.EmployeeRecord</remote>
<ejb-class>com.wombat.empl.EmployeeRecordBean</ejb-class>
...
</entity>

The ejb-ref element doesn't contain the ejb-class tag, only ejb-ref-name, that will be linked to actual ejb-class name through ejb-link tag.



Lastly what will happen when ejb-link is not there.Isn't ejb-link optional.


V good qs, i am not sure abt this, somebody please answer this. Probably the container will ignore the ejb-ref-name if ejb-link is not there and not bind it to any bean.
 
Rajan Murugan
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not because of bean class it is more of a convenience.thats what I think.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic