ejb home local remote

[size=large]从JBUIDER6中翻译的关于接口的资料:
一个EJB至少为会话BEAN或实体BEAN提供两种接口。对于EJB 1.x,你至少要创建一个home interface和remote interface;对于EJB 2.0可以有一个Remote home,Remote interface,还可以有一个Local home,Local interface。Remote home,Remote interface为客户端提供了BEAN的远程视图,而Local home,Local interface为客户端提供了BEAN的本地视图。remote and/or local home interface定义了客户端程序用来创建、定位、销毁BEAN实例的方法;remote/local interface实现了BEAN的商业方法客户端是通过remote/local interface来访问这些方法的。
BEAN的home interface,无论是remote还是local,控制了BEAN的生命周期。它包含了创建、查找、删除一个BEAN实例的方法。作为BEAN的提供商,你必须定义home 接口,但可以不实现它。EJB容器会产生一个home对象,并返回一个引用给BEAN。
一个EJB的客户端可以有BEAN的远程视图或本地视图,remote bean有一个home interface,它扩展了EJBHome interface;local bean有一个home interface,它扩展了EJBLocalHome interface。每个remote /local interface都扩展了javax.ejb.EJBHome interface。

一个实体BEAN是被设计用来为多个客户端服务的,一个客户端创建了实体BEAN,其他客户端也应该可以使用它。
remote or local interface描述了客户端程序可以调用的商业方法。当在remote or local interface中定义了这些方法后,你要在BEAN class中实现它,客户端不会直接访问BEAN,他们是通过remote or local interface来访问这些方法的。
remote or local interface中定义的方法必须遵守以下原则:
它必须是public的;
如果是定义在remote interface中的方法,它必须抛出java.rmi.RemoteException;如果不是,它不能抛出java.rmi.RemoteException。
所有客户端能访问的方法必须在remote or local interface中定义。


BEAN的interface的几种选择:
选择Remote意味着EJB Designer生成一个Bean class,Remote home和Remote interface。
选择Local意味着EJB Designer生成一个Bean class,Local home和Local interface。
如果选择Remote/Local,EJB Designer将生成Bean class,Remote home,Remote interface,Local home和Local interface。在JBUILDER中,会话BEAN默认是remote的,实体BEAN默认是local的。
如果你为一个会话BEAN (Component)选择了Remote/Local,将生成的文件如下:
ComponentHome - the remote home interface;
ComponentBean - the bean class;
Component - the remote interface ;
ComponentLocalHome - the local home interface ;
ComponentLocal - the local interface。

如果你为一个实体BEAN (Component)选择了Remote/Local,将生成的文件如下:
ComponentHome - the local home interface ;
ComponentBean - the bean class ;
Component - the local interface ;
ComponentRemoteHome - the remote home interface ;
ComponentRemote - the remote interface。[/size]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Files contained in javax.ejb.jar: META-INF/MANIFEST.MF javax.ejb.AccessLocalException.class javax.ejb.AccessTimeout.class javax.ejb.ActivationConfigProperty.class javax.ejb.AfterBegin.class javax.ejb.AfterCompletion.class javax.ejb.ApplicationException.class javax.ejb.Asynchronous.class javax.ejb.AsyncResult.class javax.ejb.BeforeCompletion.class javax.ejb.ConcurrencyManagement.class javax.ejb.ConcurrencyManagementType.class javax.ejb.ConcurrentAccessException.class javax.ejb.ConcurrentAccessTimeoutException.class javax.ejb.CreateException.class javax.ejb.DependsOn.class javax.ejb.DuplicateKeyException.class javax.ejb.EJB.class javax.ejb.EJBAccessException.class javax.ejb.EJBContext.class javax.ejb.EJBException.class javax.ejb.EJBHome.class javax.ejb.EJBLocalHome.class javax.ejb.EJBLocalObject.class javax.ejb.EJBMetaData.class javax.ejb.EJBObject.class javax.ejb.EJBs.class javax.ejb.EJBTransactionRequiredException.class javax.ejb.EJBTransactionRolledbackException.class javax.ejb.embeddable.EJBContainer.class javax.ejb.EnterpriseBean.class javax.ejb.EntityBean.class javax.ejb.EntityContext.class javax.ejb.FinderException.class javax.ejb.Handle.class javax.ejb.HomeHandle.class javax.ejb.IllegalLoopbackException.class javax.ejb.Init.class javax.ejb.Local.class javax.ejb.LocalBean.class javax.ejb.LocalHome.class javax.ejb.Lock.class javax.ejb.LockType.class javax.ejb.MessageDriven.class javax.ejb.MessageDrivenBean.class javax.ejb.MessageDrivenContext.class javax.ejb.NoMoreTimeoutsException.class javax.ejb.NoSuchEJBException.class javax.ejb.NoSuchEntityException.class javax.ejb.NoSuchObjectLocalException.class javax.ejb.ObjectNotFoundException.class javax.ejb.PostActivate.class javax.ejb.PrePassivate.class javax.ejb.Remote.class javax.ejb.RemoteHome.class javax.ejb.Remove.class javax.ejb.RemoveException.class javax.ejb.Schedule.class javax.ejb.ScheduleExpression.class javax.ejb.Schedules.class javax.ejb.SessionBean.class javax.ejb.SessionContext.class javax.ejb.Session

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值