----- Original Message ----- 
From: "Guy Rouillier" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 24, 2001 8:59 PM
Subject: Re: [JBoss-user] access modifiers lost in EJB programming ?


> Interesting this topic should come up now.  I've been wondering why EJBs are
> not defined as implementing their remote interfaces.  A session bean, for
> example, is defined as implementing only SessionBean, and not its own remote
> interface.  I agree with your sentiment below, that  an interface is a
> specification.  IMHO, EJBs should be defined as implementing their remote
> interfaces, as that interface is the spec to which clients are written.
> This would enable the compiler to ensure that the EJB has completely
> implemented its remote interface.
> 
The deployment phase of an EJB typically verfies that the EJB has implemented the
interface correctly. If you want to ensure that this is the case use the common
pattern of defining your business interface and then inheriting the EJB remote
interface from it and have your bean implement it:

public interface IHello
{
    public String hello() throws RemoteException;
}

public interface Hello extends EJBObject, IHello
{
    // No new methods
}

public class HelloBean implements IHello, SessionBean
{
    public String hello()
    {
        ...
    }
    ...
}



_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to