spring 的platformTrasactionoManager API讲解(翻译)
来源:互联网 发布:机构投资者持股数据 编辑:程序博客网 时间:2024/05/22 01:49
platformTrasactionoManager是Spring事务的基础的中心接口,应用程序可以直接使用它,但它并不是主要用来作API:典型的,应用程序将使用TransactionTemplate或通过AOP声明式事务划分。
对于实现者,建议使用AbstractPlatformTransactionManager类,它预实现传播行为的定义和负责的事务同步处理,子类必须为特定的底层事务实现模板方法,例如: begin, suspend, resume, commit.
这种策略接口的默认实现JtaTransactionManagerDataSourceTransactionManager,这可以作为其他事务策略的实施指南
Method Summary
void
commit(TransactionStatus status)
根据它的事务状态提交事务
TransactionStatus
getTransaction(TransactionDefinition definition)
返回当前活动事务或创建一个新的,根据指定的传播行为.
void
rollback(TransactionStatus status)
执行一个给定的事务回滚
Method Detail
getTransaction
TransactionStatus getTransaction(TransactionDefinition definition)
throwsTransactionException
s
commit
void commit(TransactionStatus status)
throws TransactionException
根据它的事务状态提交事务.如果事务被rollback-only编程方式,执行回滚。
如果没有一个新的事务,省略提交适当的参与周围的事务.如果前一个事务已经暂停能够创建一个新的,恢复以前的事务提交后新的后.
注意,当提交调用完成后,无论如果正常或抛出异常,事务必须充分和清理完成.不回滚调用应该在这种情况下。
如果这种方法除了TransactionException抛出异常,那么一些before-commit错误导致提交的尝试失败.例如,一个O / R映射工具可能试图变更刷新到数据库之前提交,与结果DataAccessException导致提交失败.原始异常将被传递到调用者提交的方法在这种情况下。
Parameters:
status - object returned by thegetTransaction method
Throws:
UnexpectedRollbackException -在一个意想不到的回滚事务协调器初始化
HeuristicCompletionException - in case of atransaction failure caused by a heuristic decision on the side of thetransaction coordinator
TransactionSystemException - in case ofcommit or system errors (typically caused by fundamental resource failures)
IllegalTransactionStateException - if the giventransaction is already completed (that is, committed or rolled back)
TransactionException
See Also:
TransactionStatus.setRollbackOnly()
rollback
void rollback(TransactionStatus status)
throws TransactionException
执行一个给定的事务回滚.
如果不是一个新的事务,只是将它设置为properparticipation rollback-only周围的事务.如果先前transactionhas被停职能够创建一个新的,恢复previoustransaction回滚新的事务后,不回滚事务如果commit抛出一个异常,当commit返回时,事务应该已经完成和被清理,即使在一个 commitexception.因此,当提交失败是回滚将导致出现IllegalTransactionStateException.
Parameters:
status - object returned by thegetTransaction method
Throws:
TransactionSystemException - in case of rollback or systemerrors(typically caused by fundamental resource failures)
IllegalTransactionStateException - if the given transactionis alreadycompleted (that is, committed or rolled back)
TransactionException
- spring 的platformTrasactionoManager API讲解(翻译)
- TransactionProxyFactoryBean spring事务代理的工程bean API讲解/翻译
- AbstractPlatformTransactionManager(Spring事务底层核心类)API讲解翻译
- JSF+Spring+Hibernate的实例讲解(原创翻译)
- JSF+Spring+Hibernate的实例讲解(原创翻译)
- JSF+Spring+Hibernate的实例讲解(原创翻译)
- Spring的讲解(一)
- OpenLayers的API讲解(一)
- OpenLayers的API讲解(二)
- View 的API讲解
- SYNTH (in J2SE5.0)的基础讲解 --翻译篇
- Spring-Kafka 2.0.0发送API翻译
- moodle的一些api翻译~$page翻译
- 《Spring Live》的翻译
- spring aop的讲解
- spring的scope讲解
- Spring的AOP讲解
- 【Android Api 翻译4】android api 完整翻译之Contacts Provider (学习安卓必知的api,中英文对照)
- GYM 100247 A. The Power of the Dark Side(水~)
- Spring AOP
- [IOS APP]曾仕强演说精选-有声系列
- HDU 3652 B-number
- 数据库事务四种隔离级别
- spring 的platformTrasactionoManager API讲解(翻译)
- 一天一个LINUX命令教程[4]-chmod命令
- 树的广度优先遍历(非递归)和深度优先遍历
- Linux SVN命令详解
- 操作系统之分页分段介绍
- 创建Maven项目
- 为什么linux大多用在服务器端
- Maven 入门
- 方法和数组