When does EJB2.0 use Local Interface, when do you use Remote Interface

zhaozj2021-02-11  232

When does EJB2.0 use Local Interface, when do you use Remote Interface

Local Interface is a new feature of EJB2.0, which allows you to access your EJB components without any repeated network communication. It also allows you to pass non-sequential parameters, very easy. So the value of Remote Interface is it? It's actually not a valuable stuff unless: 1. You need to access your system remotely (that is, from a remote web layer), or 2. You try to go Test your EJB components separately and need to be tested from a separate client to access them.

The issue of local interface and remote interface is a little difference between the code. Local Interface has different interface names, not using portableremoteObject.narrow () and there is no RemoteException thrown. Because of this, you need to rewrite the client code to switch between the two interfaces. This is the unfortunate result of programming adjustment. In order to limit the amount you need, you need to decide your bean's client or remote before you encode. For example, if you build a web-based system, you should decide your system is a complete J2EE app in a process, or whether your web layer is separated from your EJB layer to become an independent Process.

Finally, if you connect your EJB Deployment from a very remote client, consider using XML-based web service to express your EJB system instead of remote interface.

转载请注明原文地址:https://www.9cbs.com/read-5228.html

New Post(0)