javax.transaction.UserTransaction翻译

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

javax.transaction
Interface UserTransaction

public interface UserTransaction

The UserTransaction interface defines the methods that allow an application to explicitly manage transaction boundaries. UserTransaction接口定义了一些方法,以允许应用明确管理事务的界线。

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

Method Summary
void begin()
Create a new transaction and associate it with the current thread. 创建一个新事物并与当前线程关联。
void commit()
Complete the transaction associated with the current thread. 完成与当前线程关联的事务。
int getStatus()
Obtain the status of the transaction associated with the current thread. 获取与当前线程关联事务的状态。
void rollback()
Roll back the transaction associated with the current thread. 回滚与当前线程关联的事务。
void setRollbackOnly()
Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction. 修改当前线程的关联事务,使得事务的唯一可能结果是回滚该事务。
void setTransactionTimeout(intseconds)
Modify the timeout value that is associated with transactions started by subsequent invocations of the begin method. 修改随后使用begin方法调用开始的事务超时值。

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

Method Detail
<!-- -->

begin

Create a new transaction and associate it with the current thread. 创建一个新事物并与当前线程关联。

Throws:
NotSupportedException - Thrown if the thread is already associated with a transaction and the Transaction Manager implementation does not support nested transactions. 当线程已经与事务关联,事务管理器的实现不支持嵌套事务时抛出。
SystemException - Thrown if the transaction manager encounters an unexpected error condition. 如果事务管理器遭遇无法预料错误的情况时抛出。
<!-- -->

commit

Complete the transaction associated with the current thread. When this method completes, the thread is no longer associated with a transaction. 完成与当前线程关联的事务。方法完成后,线程不再与事务关联。

Throws:
RollbackException - Thrown to indicate that the transaction has been rolled back rather than committed. 抛出表示事务已被回滚而不是提交。
HeuristicMixedException - Thrown to indicate that a heuristic decision was made and that some relevant updates have been committed while others have been rolled back. 抛出表示已经确定,某些相关更新已提交,然而其它一些被回滚。
HeuristicRollbackException - Thrown to indicate that a heuristic decision was made and that all relevant updates have been rolled back. 抛出表示已经确定,所有相关更新已回滚。
SecurityException - Thrown to indicate that the thread is not allowed to commit the transaction. 抛出表示当前线程不允许提交该事务。
IllegalStateException - Thrown if the current thread is not associated with a transaction. 如果当前线程没有和事务关联时抛出。
SystemException - Thrown if the transaction manager encounters an unexpected error condition. 如果事务管理器遭遇无法预料错误的情况时抛出。
<!-- -->

rollback

Roll back the transaction associated with the current thread. When this method completes, the thread is no longer associated with a transaction. 回滚与当前线程关联的事务。方法完成后,线程不再与事务关联。

Throws:
SecurityException - Thrown to indicate that the thread is not allowed to roll back the transaction. 抛出表示当前线程不允许回滚事务。
IllegalStateException - Thrown if the current thread is not associated with a transaction. 如果当前线程没有和事务关联时抛出。
SystemException - Thrown if the transaction manager encounters an unexpected error condition. 如果事务管理器遭遇无法预料错误的情况时抛出。
<!-- -->

setRollbackOnly

Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction. 修改当前线程的关联事务,使得事务的唯一可能结果是回滚该事务。

Throws:
IllegalStateException - Thrown if the current thread is not associated with a transaction. 如果当前线程没有和事务关联时抛出。
SystemException - Thrown if the transaction manager encounters an unexpected error condition. 如果事务管理器遭遇无法预料错误的情况时抛出。
<!-- -->

getStatus

Obtain the status of the transaction associated with the current thread. 获取与当前线程关联事务的状态。

Returns:
The transaction status. If no transaction is associated with the current thread, this method returns the Status.NoTransaction value. 事务状态。如果当前线程没有关联事务,方法返回Status.NoTransaction值。
Throws:
SystemException - Thrown if the transaction manager encounters an unexpected error condition. 如果事务管理器遭遇无法预料错误的情况时抛出。
<!-- -->

setTransactionTimeout

Modify the timeout value that is associated with transactions started by subsequent invocations of the begin method. 修改随后使用begin方法调用开始的事务超时值。

If an application has not called this method, the transaction service uses some default value for the transaction timeout. 如果应用没有调用该方法,事务服务将使用事务超时的默认值。

Parameters:
seconds - The value of the timeout in seconds. If the value is zero, the transaction service restores the default value. If the value is negative a SystemException is thrown. 以秒为单位的超时值。如果值为0,事务服务恢复为初始值。如果值为负,抛出SystemException。
Throws:
SystemException - Thrown if the transaction manager encounters an unexpected error condition. 如果事务管理器遭遇无法预料错误的情况时抛出。
<!-- ========= 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、付费专栏及课程。

余额充值