Prerequisites
These rules do not imply that both remote and local view types must be created; these are just naming conventions when creating source for a set of bean interfaces.
A new EJB entry to the deployment descriptor is only added when a minimum set of resources are available in the free-form project. For example, if the bean class is placed in the free-form project, its compiled class maps to the EJB project but no deployment descriptor entry is created until the rapid deployment tools locate either a set of remote view type classes or local view type classes. For entity beans, a primary key class is also required. If the minimum resources are removed, the bean descriptor entry is removed. The examples section of this topic provides a concrete example of these rules.
Steps
Example
This example shows the activities of the bean entry in the deployment descriptor when EJB resources are added and removed from the free-form project.
[08:47:25 PM] [/MyProject/ejbs/MyEJB.java] Added [08:47:25 PM] [/MyProject/ejbs/MyEJBBean.java] Added [08:47:25 PM] [/MyProject/ejbs/MyEJBHome.java] Added [08:47:30 PM] [/MyProject/bin/ejbs/MyEJB.class] copied to project [MyProjectEJBClient] [08:47:30 PM] [/MyProject/bin/ejbs/MyEJBBean.class] copied to project [MyProjectEJB] [08:47:30 PM] [/MyProject/bin/ejbs/MyEJBHome.class] copied to project [MyProjectEJBClient] [08:47:32 PM] Enterprise bean added to ejb-jar.xml: MyEJB [08:47:32 PM] Enterprise bean binding for [MyEJB] added to ejb-jar-bnd.xmi. JNDI Name is: [ejb/MyEJBBean]A new enterprise bean entry is created in the deployment descriptor (found in the ejbModule\META-INF\ejb-jar.xml file in the EJB module project):
<session id="Session_1092185252700"> <ejb-name>MyEJB</ejb-name> <home>ejbs.MyEJBHome</home> <remote>ejbs.MyEJB</remote> <ejb-class>ejbs.MyEJBBean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> </session>A new enterprise bean binding is created in the bindings with a default JNDI name. The ibm-ejb-bnd.xmi file might contain the following entries:
<ejbBindings xmi:id="EnterpriseBeanBinding_1092185252700" jndiName="ejb/MyEJBBean"> <enterpriseBean xmi:type="ejb:Session" href="META-INF/ejb-jar.xml#Session_1092185252700"/> </ejbBindings>
[08:52:59 PM] [/MyProject/ejbs/MyEJBLocal.java] Added [08:52:59 PM] [/MyProject/ejbs/MyEJBLocalHome.java] Added [08:52:59 PM] [/MyProject/bin/ejbs/MyEJBLocal.class] copied to project [MyProjectEJBClient] [08:52:59 PM] [/MyProject/bin/ejbs/MyEJBLocalHome.class] copied to project [MyProjectEJBClient] [08:53:01 PM] Local view type added for ejb: MyEJBAn update is made to the existing deployment descriptor (found in the ejbModule\META-INF\ejb-jar.xml file in the EJB module project):
<session id="Session_1092185252700"> <ejb-name>MyEJB</ejb-name> <home>ejbs.MyEJBHome</home> <remote>ejbs.MyEJB</remote> <local-home>ejbs.MyEJBLocalHome</local-home> <local>ejbs.MyEJBLocal</local> <ejb-class>ejbs.MyEJBBean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> </session>
[08:56:27 PM] [/MyProject/bin/ejbs/MyEJBLocal.class] Deleted [08:56:27 PM] [/MyProject/ejbs/MyEJBLocal.java] Deleted [08:56:28 PM] Local view type removed ejb: MyEJBSince the local interface was removed from the free-form project and the existing local home interface is not sufficient to define a local view type the bean deployment descriptor (found in the ejbModule\META-INF\ejb-jar.xml file in the EJB module project) is updated to reflect the removal of the local view type:
<session id="Session_1092185252700"> <ejb-name>MyEJB</ejb-name> <home>ejbs.MyEJBHome</home> <remote>ejbs.MyEJB</remote> <ejb-class>ejbs.MyEJBBean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> </session>
[09:00:04 PM] [/MyProject/bin/ejbs/MyEJB.class] Deleted [09:00:04 PM] [/MyProject/ejbs/MyEJB.java] Deleted [09:00:09 PM] Enterprise bean removed from ejb-jar.xml: MyEJBSince the remote interface has been removed from the free-form project, the existing home interface is not sufficient to define a remote view type. Both the remote and local view types are not defined, so the bean and its bindings are removed from the deployment descriptor.