[jboss-user] [EJB 3.0] - Local and Remote interfaces required in EJB3

esfahan do-not-reply at jboss.com
Mon Oct 16 13:17:37 EDT 2006


Hi there,

I am trying to get started with EJB3 and Seam and have a question regarding remote and local interfaces. It seems to define a stateful bean I have to do something along this lines:

@Local
public interface Foo
{
  ...
}

@Stateful
public class FooBean implements Foo
{
 ...
}

I have to specify and interface which I annoate with @Local and then I need an actual bean implementation which I annoate with @Stateful. However, I thought that in EJB3 I don't need interfaces anymore. I hoped to be able to annoate a simple POJO. I recall reading somewhere that if eg I annotate a POJO as Stateful with no other annotation per default all public methods become part of the business interface. If I try to put the @Local annotation on FooBean itself removing the 'implements Foo' I get 

java.lang.RuntimeException: bean class has no local, webservice, or remote interfaces defined and does not implement at least one business interface

Why are these interfaces still required. I could imagine something like this

@Stateful
public class FooBean implements Foo
{
   @LocalMethod
   public void foo();

   @LocalMethod
   @RemoteMethod
   public void bar();
}

Why can I not annotate in a simple POJO which of my methods are exposed in the local/remote business interface.  Of course I realize how much simpler EJB3 had become compared to EJB2, but without beeing able to annotate the buisness interface in the actual POJO it seems to be a half hearted apporach.

Am I missing something?

--Hardy




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978601#3978601

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3978601



More information about the jboss-user mailing list