<!-- -->
|
JavaTM 2 Platform Ent. Ed. v1.4 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> All Classes <noscript></noscript> | |||||||
SUMMARY:NESTED|FIELD|CONSTR|METHOD | DETAIL:FIELD|CONSTR|METHOD |
The SessionSynchronization interface allows a session Bean instance to be notified by its container of transaction boundaries. SessionSynchronization接口允许会话Bean实例接收容器关于事务边界的通知。
An session Bean class is not required to implement this interface. A session Bean class should implement this interface only if it wishes to synchronize its state with the transactions. 会话Bean类不要求实现该接口。只有当会话Bean类希望实现与事务同步状态时才应该实现该接口。
<!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><!-- -->
Method Summary | |
void |
afterBegin() The afterBegin method notifies a session Bean instance that a new transaction has started, and that the subsequent business methods on the instance will be invoked in the context of the transaction. afterBegin方法通知会话Bean实例新事务开始,随后该实例的业务方法将在事务上下文中调用。 |
void |
afterCompletion(booleancommitted) The afterCompletion method notifies a session Bean instance that a transaction commit protocol has completed, and tells the instance whether the transaction has been committed or rolled back. afterCompletion方法通知会话Bean实例事务提交协议已经完成,告知实例事务 是要提交还是回滚。 |
void |
beforeCompletion() The beforeCompletion method notifies a session Bean instance that a transaction is about to be committed. beforeCompletion方法通知会话Bean实例事务将被提交。 |
<!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><!-- -->
Method Detail |
public void afterBegin() throws EJBException, RemoteException
The instance can use this method, for example, to read data from a database and cache the data in the instance fields. 实例可以使用该方法,比如从数据库中读取数据,在实例字段中缓存数据。
This method executes in the proper transaction context. 该方法在原事务上下文中执行。
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 and higher specifications should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB 2.0 and higher specifications must not throw the java.rmi.RemoteException. 方法签名中定义该异常是为了对符合EJB 1.0规范的企业bean提供向下兼容。 符合EJB 1.1规范的企业bean应该抛出javax.ejb.EJBException来代替该异常。 符合EJB 2.0或更高版本规范的企业bean也应该抛出javax.ejb.EJBException 来代替该异常。
public void beforeCompletion() throws EJBException, RemoteException
This method executes in the proper transaction context. 该方法在原事务上下文中执行。
Note: The instance may still cause the container to rollback the transaction by invoking the setRollbackOnly() method on the instance context, or by throwing an exception. 注意:实例可是有可能在实例上下文中调用setRollbackOnly()方法或者抛出异常造成容器回滚事务。
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 and higher specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB 2.0 and higher specifications must not throw the java.rmi.RemoteException. 方法签名中定义该异常是为了对符合EJB 1.0规范的企业bean提供向下兼容。 符合EJB 1.1规范的企业bean应该抛出javax.ejb.EJBException来代替该异常。 符合EJB 2.0或更高版本规范的企业bean也应该抛出javax.ejb.EJBException 来代替该异常。
public void afterCompletion(booleancommitted) throws EJBException, RemoteException
This method executes with no transaction context. 该方法不在事务上下文中执行。
committed
- True if the transaction has been committed, false if is has been rolled back. 如果事务已提交,返回true,如果已回滚,返回false。
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 and higher specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB 2.0 and higher specifications must not throw the java.rmi.RemoteException. 方法签名中定义该异常是为了对符合EJB 1.0规范的企业bean提供向下兼容。 符合EJB 1.1规范的企业bean应该抛出javax.ejb.EJBException来代替该异常。 符合EJB 2.0或更高版本规范的企业bean也应该抛出javax.ejb.EJBException 来代替该异常。
<!-- -->
|
JavaTM 2 Platform Ent. Ed. v1.4 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> All Classes <noscript></noscript> | |||||||
SUMMARY:NESTED|FIELD|CONSTR|METHOD | DETAIL:FIELD|CONSTR|METHOD |
Copyright 2003 Sun Microsystems, Inc. All rights reserved.