解惑 spring 嵌套事务与ejb事务

解惑 spring 嵌套事务与ejb事务

ID:20448923

大小:60.50 KB

页数:9页

时间:2018-10-12

解惑 spring 嵌套事务与ejb事务_第1页
解惑 spring 嵌套事务与ejb事务_第2页
解惑 spring 嵌套事务与ejb事务_第3页
解惑 spring 嵌套事务与ejb事务_第4页
解惑 spring 嵌套事务与ejb事务_第5页
资源描述:

《解惑 spring 嵌套事务与ejb事务》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、解惑spring嵌套事务/***@author王政*@date2006-11-24*@note转载请注明出处*/在所有使用spring的应用中,声明式事务管理可能是使用率最高的功能了,但是,从我观察到的情况看,绝大多数人并不能深刻理解事务声明中不同事务传播属性配置的的含义,让我们来看一下TransactionDefinition接口中的定义代码/***Supportacurrenttransaction,createanewoneifnoneexists.*AnalogoustoEJBtransactionattributeofthesamename.*

Thisistypically

2、thedefaultsettingofatransactiondefinition.*/intPROPAGATION_REQUIRED=0;/***Supportacurrenttransaction,executenon-transactionallyifnoneexists.*AnalogoustoEJBtransactionattributeofthesamename.*

Note:Fortransactionmanagerswithtransactionsynchronization,*PROPAGATION_SUPPORTSisslightlydifferentfromnot

3、ransactionatall,*asitdefinesatransactionscoppthatsynchronizationwillapplyfor.*Asaconsequence,thesameresources(JDBCConnection,HibernateSession,etc)*willbesharedfortheentirespecifiedscope.Notethatthisdependson*theactualsynchronizationconfigurationofthetransactionmanager.*@seeorg.springframework.tran

4、saction.support.AbstractPlatformTransactionManager#setTransactionSynchronization*/intPROPAGATION_SUPPORTS=1;/***Supportacurrenttransaction,throwanexceptionifnoneexists.*AnalogoustoEJBtransactionattributeofthesamename.*/intPROPAGATION_MANDATORY=2;/***Createanewtransaction,suspendthecurrenttransacti

5、onifoneexists.*AnalogoustoEJBtransactionattributeofthesamename.*

Note:Actualtransactionsuspensionwillnotworkonout-of-the-box*onalltransactionmanagers.ThisinparticularappliestoJtaTransactionManager,*whichrequiresthejavax.transaction.TransactionManagertobe*madeavailableittoit(whichiss

6、erver-specificinstandardJ2EE).*@seeorg.springframework.transaction.jta.JtaTransactionManager#setTransactionManager*/intPROPAGATION_REQUIRES_NEW=3;/***Executenon-transactionally,suspendthecurrenttransactionifoneexists.*AnalogoustoEJBtransactionattributeofthesamename.*

Note:Actualtransactionsuspen

7、sionwillnotworkonout-of-the-box*onalltransactionmanagers.ThisinparticularappliestoJtaTransactionManager,*whichrequiresthejavax.transaction.TransactionManagertobe*madeavailableittoit(whichisserver-spe

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。