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

public void setSessionContext(SessionContextctx)
                       throws EJBException,
                              RemoteException
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

public void ejbRemove()
               throws EJBException,
                      RemoteException
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

public void ejbActivate()
                 throws EJBException,
                        RemoteException
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

public void ejbPassivate()
                  throws EJBException,
                         RemoteException
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.

你可能感兴趣的:(bean,ejb,sun)