为什么我们需要为EJB 3.0会话bean单独的远程和本地接口 [英] Why do we need separate Remote and Local interfaces for EJB 3.0 session beans

查看:134
本文介绍了为什么我们需要为EJB 3.0会话bean单独的远程和本地接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道为什么我们需要为EJB 3.0会话bean单独的Remote和Local接口。我猜大多数时候他们都会定义同一份合同。为什么我有一个通用的界面,在我的Bean中,我应该可以说我想要这个bean被远程访问和/或本地访问。

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 cant I have a common interface and in my Bean I should just be able to say that I want this bean to be accessed remotely and/or locally.

谢谢
Vikas

thanks Vikas

推荐答案

这是EJB规范所说:

本地和远程编程模型之间的选择是Bean Provider在开发企业bean时所做的设计决策。

虽然可以提供远程客户机视图和本地

JSR220第3章

所以当写一个bean考虑了谁是客户端,本地客户端不太可能需要相同的方法,甚至与远程客户端相同的bean。

So when writing a bean think about who is the client, it's very unlikely that a local client will need the same methods or even the same bean that a remote one.

这篇关于为什么我们需要为EJB 3.0会话bean单独的远程和本地接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆