This dialog box generates a reference to an enterprise bean in a Java class
file. Once you have a reference to the bean or bean interface, you
can call the bean's business methods.
You open the dialog box by right-clicking in the file from which you want to
call the bean and choosing Insert Code > Call Enterprise Bean.
The file must be located in an EJB module project or web application project.
You cannot run the command from a .
You use the dialog box in the following way:
The top panel lists all enterprise beans in open projects.
Select the enterprise bean you want to call.
Select whether to use inline lookup code or use an existing service
locator class.
Specify the interface view that you want to use.
In order to reference a bean's local interface, the class that is referencing
the bean must be packaged in the same enterprise application or web application as the enterprise
bean.
Click OK.
When you call an enterprise bean, the following occurs:
A lookup method is created in the caller class.
The enterprise bean project is added to the caller project's classpath.
A reference to the bean that is called is added to the deployment
descriptor of the caller project or the resource is injected using annotations.
If and where the reference is added depends on which of the following applies:
If the lookup is made from an enterprise bean implementation class,
the reference is added to the corresponding bean.
If the lookup is made from any class of a web application, the reference
is added to the web application.
If the lookup is made from a plain Java class of an EJB module, no reference
is added. In this case, the reference has to be added manually to the
bean calling the plain Java class.