This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
EJB2.0 is supposed to support dual-role beans, where both a local and a remote interface are present in the same bean for maximum flexibility. But when you do the JNDI lookup to locate the bean, you can create JNDI to locate only one type, i.e home or remote. So, if I have an EJB client that is deployed locally, but wants to use the local interface(on one occasion) AND remote interface(on another occasion) how do you configure the JNDI for the bean to do both. Can anyone help me with this.
You simply use different JNDI names for the interfaces (i.e. "BeanLocal" and "BeanRemote") and use the appropriate one when looking for the interface you want. Here's some sample from one deployment descriptor of mine: <session> <ejb-name>DepartmentManager</ejb-name> <jndi-name>DepartmentManager</jndi-name> <local-jndi-name>DepartmentManagerLocal</local-jndi-name> </session> When I want to use the local interface I lookup for the "DepartmentManagerLocal" home interface, and when I want to use the bean remotely I lookup for the "DepartmentManager" home interface. Hope it's all clear now.