Java Reference
In-Depth Information
The reason we need to have a remote and/or optional local interface is because
session bean clients never invoke the bean's methods directly, instead they obtain a
reference of a class implementing their remote and/or local interface and invoke the
methods on this class. Beginning with Java EE 6, it is no longer necessary to create
a local interface; the application server can generate one automatically when the
application is deployed.
The remote and/or local interface implementation is created automatically by the
EJB container when we deploy our bean. This implementation does some processing
before invoking our session bean's method. Since the methods need to be defined
both on the interface and our bean, typically we would need to add the method
signature to both the bean and its remote and/or local interface. However, when
working with session beans in NetBeans, we can simply right-click on the bean's
source code and select Insert Code | Add Business Method , this will result in the
method being added to both the bean and the remote/local interface.
Doing this results in a window popping up, prompting us for the method name,
return type, parameters, and the interface(s) where the method should be added
(remote and/or local).
 
Search WWH ::




Custom Search