Spring with multiple transaction managers
为什么80%的码农都做不了架构师?>>>
Spring with multiple transaction managers
Here is repost of http://stackoverflow.com/questions/4423125/spring-is-it-possible-to-use-multiple-transaction-managers-in-the-same-applica question.
Here is applicationContext.xml config part:
- <code><bean id="transactionManager1" class="org.springframework.orm.jpa.JpaTransactionManager">
- <property name="entityManagerFactory" ref="entityManagerFactory1" />
- <qualifier value="account"/>
- </bean>
- <bean id="transactionManager2" class="org.springframework.orm.jpa.JpaTransactionManager">
- <property name="entityManagerFactory" ref="entityManagerFactory2" />
- <qualifier value="businessData"/>
- </bean></code>
and code using:
- public class TransactionalService {
- @Transactional("account")
- public void setSomethingInAccount() { ... }
- @Transactional("businessData")
- public void doSomethingInBusinessData() { ... }
- }
So, as you see we can simply use several connections with transaction management in Spring application.
See also,
http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/transaction.html#tx-multiple-tx-mgrs-with-attransactional
Enjoy!
转载于:https://my.oschina.net/dongwq/blog/182884
Spring with multiple transaction managers相关推荐
- Spring JTA multiple resource transactions in Tomcat with Atomikos example--转载
原文地址:http://www.javacodegeeks.com/2013/07/spring-jta-multiple-resource-transactions-in-tomcat-with-a ...
- spring事务管理-Transaction模板(了解)
那就迫切的需要事务来进行管理了,给大家演示在Spring中,要给咱们Service加事务,怎么加,现在是不是还没有加事务的,现在没有加事务,怎么加,我们要演示三种方式,三种方式 演示完,Spring管 ...
- 【Spring】21、用spring目标对象处理Transaction rolled back because it has been marked as rollback-only...
在使用spring做事务管理时,很多人都会遇到这样一段异常: org.springframework.transaction.UnexpectedRollbackException: Transact ...
- Spring嵌套事务异常Transaction rolled back because it has been marked as rollback-only
项目场景: 在循环里面使用try-catch去捕获异常的时候,并且try里面调的方法它也使用了事务注解 @transactional或者用了事务切面AOP去实现方法事务注入 问题描述 我这里的业务需求 ...
- spring事务操作Transaction
web层 service(事务逻辑层)业务操作 创建转账的方法,调用dao的两个方法 Dao层(数据访问层)数据库操作,无业务操作,创建两个方法,(1)少钱(2)多钱 事务操作 1.事务添加到java ...
- 【Spring】actual transaction available for current thread - cannot reliably process ‘remove‘ call
1.场景1 1.1 概述 一段代码大概是这样的 service 层 @Transactional public void delAndAdd(){repo1.deleteByModule(" ...
- spring Transaction Management --官方
原文链接:http://docs.spring.io/spring/docs/current/spring-framework-reference/html/transaction.html 12. ...
- Spring Transaction : TransactionAspectSupport
概述 TransactionAspectSupport 是Spring的事务切面逻辑抽象基类,该类实现了事务切面逻辑,但是自身设计为不能被直接使用,而是作为抽象基类被实现子类使用,应用于声明式事务使用 ...
- Spring Boot JPA 中transaction的使用
文章目录 @Transactional的实现 @Transactional的使用 Transaction的传播级别 REQUIRED SUPPORTS MANDATORY NEVER NOT_SUPP ...
- spring 事物的传播特性
2019独角兽企业重金招聘Python工程师标准>>> 在使用spring事物通常会配置的Service层 ,当我们调用 一个service成的方法的时候 ,这个方法在执行的过程中对 ...
最新文章
- 使用 TListView 控件(3)
- tensorflow常用函数解析
- php 词法分析,【PHP7源码学习】2019-03-20 PHP词法分析
- ajax请求失败后重连和promiseIfy
- hdu 1404/zoj 2725 Digital Deletions 博弈论
- 1号店11.11:从应用架构落地点谈高可用高并发高性能
- nohup: 无法运行命令 ‘/bin/java‘: 没有那个文件或目录
- linux如何挂载U盘
- CF1110E-Magic Stones【结论题,差分】
- JBoss 4.2.x Spring 3 JPA Hibernate教程第2部分
- Leetcode-2 两数相加【c语言】
- 2018湖北技能高考计算机类学校,武汉船舶职业技术学院举行2018年湖北省技能高考...
- pycharm 文件修改的星号(*)提示||文件是否修改过
- MacOS入门技巧分享
- 开源一套基于 React Naitve 的业务驱动型 UI 组件库:react-native-atlas
- 三足鼎立 – Mac 输入法横向对比
- sobel 边缘检测 c++实现
- delln4030安装固态硬盘_戴尔灵越怎么更换固态硬盘
- NEO主要技术社区成员大曝光
- 远程监控养猪监控系统