ejb@glassfish.java.net

Re: Is it legal for the same bean to have the same local and remoter interface?

From: Kenneth Saks <Kenneth.Saks_at_Sun.COM>
Date: Thu, 23 Feb 2006 09:16:10 -0500

Sanjeeb Kumar Sahoo wrote:

> Hi Ken,
>
> Is the following allowed?
>
> /package com.sun.fossdemo;
>
> @javax.ejb.Stateless
> @javax.ejb.Remote(Sless.class)
> @javax.ejb.Local(Sless.class)

Hi Sahoo,

No, the spec doesn't allow this. Even though the rules for writing
the 3.0 local and remote business interfaces are more similar than
they were between the 2.x Remote and Local component interfaces,
it would be dangerous to use the same interface for both views since
the behavior could be different due to pass-by-value vs. pass-by-copy
semantics and the variance in allowed types.

>
> public class SlessBean2 implements Sless {
> public void createPerson(String name){
> System.out.println("createPerson " + name);
> }
> }
> /
> Since it uses annotation, will both the remote view and local view not
> end up having same bean-name which in this case is SlessBean2?
>
> Thanks,
> Sahoo
>