Java Reference
In-Depth Information
Notice that our bean implements the remote interface, which at this point is an
empty interface with the @Remote annotation added. This annotation was added
because we chose to create only a remote interface. Had our interface been a local
interface, it would have been decorated with the @Local interface instead.
The reason we need to have a remote and/or 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.
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 EJB Methods | 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