Why do we need separate Remote and Local interfaces for EJB 3.0 session beans

后端 未结 6 493
忘了有多久
忘了有多久 2020-12-23 13:59

I was wondering why do we need separate Remote and Local intefaces for EJB 3.0 Session beans. I guess most of the time they would both be defining the same contract. Why can

6条回答
  •  离开以前
    2020-12-23 14:39

    I believe that when your business needs all your methods in the Local also need to be exposed to the remote clients, then

    1. have your Local interface defined with the methods.
    2. have your remote interface with empty but extending the local interface
    3. have all the actual business logic and other implementations in Local
    4. have your remote bean implementation just delegate to the local bean implementation

    This approach could be a work around for achieving @Local & @Remote to same interface. Same method can be accessed locally if required and remotely if required, with out any performance overhead.

    This is my thought. Somebody please let me know your thoughts to validate this.

提交回复
热议问题