Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide 10g (10.1.3.5.0) Part Number E13981-01 |
|
|
View PDF |
Normally, you cannot have enterprise beans communicating across EAR files, that is, across applications that are deployed in separate EAR files. The only way for an enterprise bean to access an enterprise bean that was deployed in a separate EAR file is to declare it to be the parent of the client. Only children can invoke methods in a parent.
For example, there are two enterprise beans, each deployed within their EAR file, called Sales
and Inventory
, where the Sales
enterprise bean needs to invoke the Inventory
enterprise bean to check to see if enough widgets are available. Unless the Sales
enterprise bean defines the Inventory
enterprise bean to be its parent, the Sales
enterprise bean cannot invoke any methods in the Inventory
enterprise bean, because they are both deployed in separate EAR files. So, define the Inventory
enterprise bean to be the parent of the Sales
enterprise bean, and the Sales
enterprise bean can now invoke any method in its parent.
You can only define the parent during deployment with the deployment wizard. See the "Deploying/Undeploying Applications" section in the "Using the oc4jadmin.jar Command Line Utility" chapter in the Oracle Containers for J2EE Configuration and Administration Guide on how to define the parent application of a bean.