I have a small question on annotating a session bean class. Imagine I have a session bean and I want to provide both the Local and Remote interfaces for it. Can I just annotate at the class level
Even this is possible. I have even seen examples where the local and remote interfaces extend from a common interface. It's all upto the bean developer and also on what APIs you want to expose in a local interface and a remote interface.
Originally posted by Jaikiran Pai: Yes you can. But also remember to "implement" both these interfaces on the session bean:
As far as I can remember, session bean class does not have to explicitely implement its local/remote interfaces, in terms you don't have to put 'implements LocalInterface, RemoteInterface' clause at all, as long as bean implementation defines all methods declared in local/remote interfaces. Please correct me if I'm wrong.
Just went through the spec. You guys are right. Implementing the interfaces is optional:
The bean class may implement its business interface(s).
While it is expected that the bean class will typically implement its business interface(s), if the bean class uses annotations on the bean class or the deployment descriptor to designate its business interface(s), it is not required that the bean class also be specified as implementing the interface(s).