javax.ejb.SessionBean翻译

<!-- ========= START OF TOP NAVBAR ======= --> <!-- -->
JavaTM 2 Platform
Ent. Ed. v1.4
<!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== -->

javax.ejb
Interface SessionBean

All Superinterfaces:
EnterpriseBean , Serializable
public interface SessionBean extends EnterpriseBean

The SessionBean interface is implemented by every session enterprise Bean class. The container uses the SessionBean methods to notify the enterprise Bean instances of the instance's life cycle events. 每一个会话企业Bean的类都应该实现SessionBean接口。容器使用SessionBean的方法 将实例的生命周期事件通知企业Bean。

<!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><!-- -->

Method Summary
void ejbActivate()
The activate method is called when the instance is activated from its "passive" state. 该激活方法由实例从钝化状态被激活时调用。
void ejbPassivate()
The passivate method is called before the instance enters the "passive" state. 该钝化方法由实例进入钝化状态时调用。
void ejbRemove()
A container invokes this method before it ends the life of the session object. 容器调用该方法来终止会话对象。
void setSessionContext(SessionContextctx)
Set the associated session context. 设置关联的会话上下文。

<!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><!-- -->

Method Detail
<!-- -->

setSessionContext

Set the associated session context. The container calls this method after the instance creation. 设置关联的会话上下文。容器在实例创建后调用该方法。

The enterprise Bean instance should store the reference to the context object in an instance variable. 企业Bean实例应当在实例变量中保存上下文对象的引用。

This method is called with no transaction context. 方法调用不含事务上下文。

Parameters:
ctx - A SessionContext interface for the instance. 实例的SessionContext接口。
Throws:
EJBException - Thrown by the method to indicate a failure caused by a system-level error. 方法抛出该异常表示一个由系统级错误引起的失败。
RemoteException - This exception is defined in the method signature to provide backward compatibility for applications written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception. 方法签名中定义该异常是为了对符合EJB 1.0规范的企业bean提供向下兼容。 符合EJB 1.1规范的企业bean应该抛出javax.ejb.EJBException来代替该异常。 符合EJB 2.0或更高版本规范的企业bean也应该抛出javax.ejb.EJBException 来代替该异常。
<!-- -->

ejbRemove

A container invokes this method before it ends the life of the session object. This happens as a result of a client's invoking a remove operation, or when a container decides to terminate the session object after a timeout. 容器调用该方法来终止会话对象。当客户端调用删除方法或者容器在会话对象 超时后决定对其终止时发生。

This method is called with no transaction context. 方法调用不含事务上下文。

Throws:
EJBException - Thrown by the method to indicate a failure caused by a system-level error. 方法抛出该异常表示一个由系统级错误引起的失败。
RemoteException - This exception is defined in the method signature to provide backward compatibility for enterprise beans written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception. 方法签名中定义该异常是为了对符合EJB 1.0规范的企业bean提供向下兼容。 符合EJB 1.1规范的企业bean应该抛出javax.ejb.EJBException来代替该异常。 符合EJB 2.0或更高版本规范的企业bean也应该抛出javax.ejb.EJBException 来代替该异常。
<!-- -->

ejbActivate

The activate method is called when the instance is activated from its "passive" state. The instance should acquire any resource that it has released earlier in the ejbPassivate() method. 该激活方法由实例从钝化状态被激活时调用。实例将获得原本在ejbPassivate()方法中释放的所有资源。

This method is called with no transaction context. 方法调用不含事务上下文。

Throws:
EJBException - Thrown by the method to indicate a failure caused by a system-level error. 方法抛出该异常表示一个由系统级错误引起的失败。
RemoteException - This exception is defined in the method signature to provide backward compatibility for enterprise beans written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception. 方法签名中定义该异常是为了对符合EJB 1.0规范的企业bean提供向下兼容。 符合EJB 1.1规范的企业bean应该抛出javax.ejb.EJBException来代替该异常。 符合EJB 2.0或更高版本规范的企业bean也应该抛出javax.ejb.EJBException 来代替该异常。
<!-- -->

ejbPassivate

The passivate method is called before the instance enters the "passive" state. The instance should release any resources that it can re-acquire later in the ejbActivate() method. 该钝化方法由实例进入钝化状态时调用。实例将释放所有资源,在下次调用ejbActivate()方法后可以重新获得。

After the passivate method completes, the instance must be in a state that allows the container to use the Java Serialization protocol to externalize and store away the instance's state. 在钝化方法完成后,实例必须处于这样一种状态,可以让容器使用Java序列化策略来具体化和保存实例状态。

This method is called with no transaction context. 方法调用不含事务上下文。

Throws:
EJBException - Thrown by the method to indicate a failure caused by a system-level error. 方法抛出该异常表示一个由系统级错误引起的失败。
RemoteException - This exception is defined in the method signature to provide backward compatibility for enterprise beans written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception. 方法签名中定义该异常是为了对符合EJB 1.0规范的企业bean提供向下兼容。 符合EJB 1.1规范的企业bean应该抛出javax.ejb.EJBException来代替该异常。 符合EJB 2.0或更高版本规范的企业bean也应该抛出javax.ejb.EJBException 来代替该异常。
<!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <!-- -->
JavaTM 2 Platform
Ent. Ed. v1.4
<!-- ======== END OF BOTTOM NAVBAR ======= --> Submit a bug or feature

Copyright 2003 Sun Microsystems, Inc. All rights reserved.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值