当前位置: 技术问答>java相关
请问高手:EJB中的远程接口、本地接口、HOME接口的联系与区别是什么?应用时应注意哪些问题?
来源: 互联网 发布时间:2015-05-14
本文导语: 请问高手:EJB中的远程接口、本地接口、HOME接口的联系与区别是什么?应用时应注意哪些问题? | Remote and local access An EJB 2.0 component can be accessed remotely or locally. Clients that access a r...
请问高手:EJB中的远程接口、本地接口、HOME接口的联系与区别是什么?应用时应注意哪些问题?
|
Remote and local access
An EJB 2.0 component can be accessed remotely or locally. Clients that access a remote bean use the bean's remote and remote home interfaces. A remote home is often referred to as the home interface. A client with remote access to a bean can run on a different machine and use a different Java Virtual Machine (JVM) than the bean itself. In method calls to a remote bean, parameters are passed by value, which helps maintain loose coupling between the client and the bean.
A client with local access to a bean must run in the same JVM as the bean it accesses. A local client won't be an external client application, but rather another enterprise bean or web component. In method calls to a local bean, parameters are passed by reference, resulting in a tighter coupling between the calling bean or web component and the called bean.
Like the remote interface, the local interface provides access to the bean's business methods, while its local home interface provides access to the methods that control the life cycle of the bean as well as its finder methods. Often entity beans that have a container-managed relationship with other entity beans have local access to them.
Because beans with local interfaces must run in the same JVM, there is no need for remote calls. Therefore, the overhead of serializing and transporting objects is reduced. Usually this means greater performance.
很高兴,能和你一同切磋问题!如果我的回答有错误,希望批评指正!
因为我们需要真理,因为我们是做技术的!谢谢!
个人联系方式: worldheart@263.net
An EJB 2.0 component can be accessed remotely or locally. Clients that access a remote bean use the bean's remote and remote home interfaces. A remote home is often referred to as the home interface. A client with remote access to a bean can run on a different machine and use a different Java Virtual Machine (JVM) than the bean itself. In method calls to a remote bean, parameters are passed by value, which helps maintain loose coupling between the client and the bean.
A client with local access to a bean must run in the same JVM as the bean it accesses. A local client won't be an external client application, but rather another enterprise bean or web component. In method calls to a local bean, parameters are passed by reference, resulting in a tighter coupling between the calling bean or web component and the called bean.
Like the remote interface, the local interface provides access to the bean's business methods, while its local home interface provides access to the methods that control the life cycle of the bean as well as its finder methods. Often entity beans that have a container-managed relationship with other entity beans have local access to them.
Because beans with local interfaces must run in the same JVM, there is no need for remote calls. Therefore, the overhead of serializing and transporting objects is reduced. Usually this means greater performance.
很高兴,能和你一同切磋问题!如果我的回答有错误,希望批评指正!
因为我们需要真理,因为我们是做技术的!谢谢!
个人联系方式: worldheart@263.net
|
JB6当然有呀
比如你创建一个新的EJB2。0的SESSIONBEAN,
New -> EJB 2.0 Designer -> New -> OK -> OK -> New Sessino Bean
在Interface一项中,你就可以给这个BEAN指定接口类型了
至于什么选什么样的接口类型,刚才我已经说了
比如,你写了一个statefulbean,部署到了你的WL中,然后又写了一个
SERVLET去调用这个BEAN,而且这个SERVLET和BEAN在同一个WL中,你就
可以把这个BEAN做成LOCAL的
如果你想在另外一台机器上调用到这个BEAN,你就必须把它申明成REMOTE
比如你创建一个新的EJB2。0的SESSIONBEAN,
New -> EJB 2.0 Designer -> New -> OK -> OK -> New Sessino Bean
在Interface一项中,你就可以给这个BEAN指定接口类型了
至于什么选什么样的接口类型,刚才我已经说了
比如,你写了一个statefulbean,部署到了你的WL中,然后又写了一个
SERVLET去调用这个BEAN,而且这个SERVLET和BEAN在同一个WL中,你就
可以把这个BEAN做成LOCAL的
如果你想在另外一台机器上调用到这个BEAN,你就必须把它申明成REMOTE
|
远程接口:远程访问使能,客户通过iiop调用,客户和EJB可以是分布的。其参数和返回按值传递,要求可以通过网络能传递。
本地接口:跟一般的接口没什么区别,客户和EJB在同一JVM中运行,参数和返回值没有限制,速度较快。
Home接口:通过远程调用创建或查找EJB.与远程接口对应,有相似的限制
本地Home接口:通过本地调用创建或查找EJB,与本地接口对应。
本地接口:跟一般的接口没什么区别,客户和EJB在同一JVM中运行,参数和返回值没有限制,速度较快。
Home接口:通过远程调用创建或查找EJB.与远程接口对应,有相似的限制
本地Home接口:通过本地调用创建或查找EJB,与本地接口对应。
|
http://www.csdn.net/expert/topic/648/648068.xml?temp=.8095514