Daniel Cavalcanti wrote:
> Hello,
>
> I have a very simple question.
>
> Say I have a (stateless) session bean that will be accessed from a web
> app and and client app. I want the web app to access the bean through
> the local interface, and the client app has to access the bean through
> the remote interface. Now, here is my question: I want the bean to
> have a set of operations but I would like to have to define these
> operations in a single interface and not replicate them in the local
> and remote interfaces. So I tried this:
>
> public interface Common {
> public int someMethod(String param1, int param2);
> }
>
> @Remote()
> public interface RemoteCommon {}
>
> @Local()
> public interface LocalCommon {}
>
> @Stateless()
> public class CommonBean implements RemoteCommon, LocalCommon {
> public int someMethod(String param1, int param2) { /* do something
> here */ }
> }
>
> In other words, I tried to use RemoteCommon and LocalCommon just as
> marker interfaces, but when I try to use the bean in the web app or
> client app, the RemoteCommon and LocalCommon interfaces appear as they
> have no methods defined.
Hi Daniel,
The interface declarations above don't define any methods nor do they
extend anything. I would
have expected the following :
@Remote()
public interface RemoteCommon extends Common {}
@Local()
public interface LocalCommon extends Common {}
> What I'm trying to avoid is this:
>
> @Remote()
> public interface RemoteCommon {
> public int someMethod(String param1, int param2);
> }
>
> @Local()
> public interface LocalCommon {
> public int someMethod(String param1, int param2);
> }
>
> @Stateless()
> public class CommonBean implements RemoteCommon, LocalCommon {
> public int someMethod(String param1, int param2) { /* do something
> here */ }
> }
>
>
> thanks,
> Daniel.
>
>