True or false: an EJB cannot implement both local and remote business methods POSSIBLE ANSWERS: * True * False SOLUTION: False, it can, allthough unusual I don't understand this.
Hi there, I understand this to mean that an EJB can implement but the EJBHome and EJBLocalHome interfaces. The first can be used with remote clients) i.e. those originating outside the host JVM.) The latter can be used with local clients (i.e. those originating within the host JVM.) Darryl
Hi Darryl, I know what you are saying. But what I understood from that qn. is whether an ejb can implement both the local interface and as remote interface at the same time. That is why I was confused. Thanks Shankar
Hi there, They can implement both EJBHome and EJBLocalHome at the same time. I can't think offhand of any reasons for doing this but I can think of reasons for not doing this. Such beans could not be CMP entity beans since CMP only supports local interfaces. Also, the performance optimizations you might want to implement for local interfaces might not be the same as performance optimizations for remote interfaces. Still, implementing a bean with local and remote home interfaces would allow you to support server-side web-based applications as well as remote applications, beans running in other containers, and Swing applications. Darryl
The business methods are defined in the component interface. Beside the EJBHome and EJBLocalHome the bean implementing "local and remote business methods" has to provide also both local and remote component interfaces, which extends EJBLocalObject and EJBObject, respectively. Thus, the business methods has to be defined in both component interfaces, but only implemented once in the bean class. Thomas
When beans are to be accessed from within the application (that the EJB is part of) local interfaces improve performance. When beans are to be accessed from applications deployed on other JVMs (or different classloader hierarchy), then remote interfaces are your only choice. If the same bean is accessed from within the application, as well as other applications, then I'd provide both local and remote interfaces to the same bean. Rama