« Cherry Spiced Pork Tenderloin | Main | Using A Sequence for an EJB 3 Entity Bean with i/5 iSeries DB2 »

Comments

Ed

I very much like this approach...but "the same business interface cannot be both a local and remote business interface of the bean" - EJB3.0 simplified spec para3.2.

How do you then designate which is the remote and which is the local (without specifiying it in the XML descriptor)?

How do you recommend structuring your local and remote interfaces, given that 90% of the time you will want them to be the same?

Is it legal extend the @Local interface with an empty @Remote one - ie:

@Stateless
public class MyEJB implements MyBusinessInterface, MyRemoteBusinessInterface {
// ... implementation methods
}

@Local
public interface MyBusinessInterface { //...business interface methods...}

@Remote
public interface MyRemoteBusinessInterface extends MyBusinessInterfaces { // ...empty... }

Given that we want to minimize the amount of code and avoid 2 or even 3 interfaces with duplicate methods - what would be your preferred approach?
Thanks
Ed

Ed

Next problem, in the servlet where you use the EJB, no matter which way we go, we're still left either explicity or implicitly specifying whether the interface injected is the local or the remote one, whether we do:

// this injects the local one
@EJB(MyBusinessInterface.class)

or

// this also injects the local one
@EJB
MyLocalBusinessInterface myBiz;

so we're stuck hard-coding the implementation used, in a place where we don't want to.

Any ideas as to the solution to this?

Ed

The comments to this entry are closed.