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



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:

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

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

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?


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


// this also injects the local one
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?


The comments to this entry are closed.