ejb@glassfish.java.net

Finding out business interface type of a session bean & EOU of the JSR 220 (EJB) spec

From: Sanjeeb Kumar Sahoo <Sanjeeb.Sahoo_at_Sun.COM>
Date: Fri, 14 Apr 2006 09:56:56 +0530

Hi Linda, Mike,

Given the following definition of I1.class and I2.class:

public interface I1 {void foo();}
public interface I2 {void bar();}

I have two SLSBs FooBean.class and BarBean.class as follows:

@Stateless
@Remote
public class FooBean implements I2 {
 public void foo() {}
 public void bar() {}
}

@Stateless
@Remote(I1.class)
public class BarBean implements I2 {
 public void foo() {}
 public void bar() {}
}

Note the only difference between them is as follows:
< @Remote
---
 > @Remote(I1.class)
What are the *business interfaces* for FooBean and BarBean and what are 
their types (i.e. is it *local* business interface or *remote* business 
interface)?
I hope you agree that it should be fairly straight forward to answer 
this question. What answers do you come up with in the *first* attempt?
I have asked this question to a guy who has read the EJB 3 spec multiple 
times and he came up with wrong answer! I had to read the spec *very 
very* carefully to come with the answers myself for this simple case. 
First, I did not believe the answers I got. So I had to consult Ken Saks 
and he confirmed that the answer I got was correct. I don't want to 
disclose the answer here because I want to see what answers others are 
coming up with and if they think the spec is easy to use.
Thanks,
Sahoo