jta

How to use Atomikos Transaction Essentials with Hibernate >= 4.3

本小妞迷上赌 提交于 2019-11-27 01:57:21
问题 I switched from Hibernate 4.2 to Hibernate 4.3 and my project is not working any more. I'm getting an HibernateException: Unable to locate current JTA transaction when I do Session s = sessionFactory.getCurrentSession(); I've realized that org.hibernate.transaction.TransactionManagerLookup does not exist any more. It was deleted in Hibernate 4.3. How should I change my current configuration? <hibernate-configuration> <session-factory> <property name="connection.datasource">testDS</property>

JEE7: Do EJB and CDI beans support container-managed transactions?

限于喜欢 提交于 2019-11-27 00:51:37
Java EE7 consists of a bunch of "bean" definitions: Managed Beans 1.0 (JSR-316 / JSR-250) Dependency Injection for Java 1.0 (JSR-330) CDI 1.1 (JSR-346) JSF Managed Beans 2.2 (JSR-344) EJB 3.2 (JSR-345) In order to get rid of the chaos in my mind, I studies several articles of "when to use which bean type". One of the pros for EJB seems to be that they alone support declarative container-managed transactions (the famous transaction annotations). I'm not sure, though, if this is correct. Can anyone approve this? Meanwhile, I came up with a simple demo application to check if this was actually

详解阿里P7架构师是怎么在Spring中实现事务暂停

≯℡__Kan透↙ 提交于 2019-11-27 00:29:35
摘要 Spring框架是一个流行的基于轻量级控制反转容器的Java/J2EE应用框架,尤其在数据访问和事务管理方面的能力是众所周知的。Spring的声明性事务分离可以应用到任何POJO目标对象,并且包含所有EJB基于容器管理事务中的已声明事务。后台的事务管理器支持简单的基于JDBC的事务和全功能的基于JTA的J2EE事务。 这篇文章详细的讨论了Spring的事务管理特性。重点是如何在使用JTA作为后台事务策略的基础上让POJO利用Spring的声明性事务,这也显示了Spring的事务服务可以无缝地与J2EE服务器(如BEA WebLogic Server的事务协调器)的事务协调器进行交互,作为EJB CMT传统事务分离方式的一个替代者。 POJO的声明性事务 作为Spring声明性事务分离方式的样例,让我们来看一下Spring的样例应用PetClinic的中心服务外观中的配置: 清单1: <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName"> <value>java:comp/env/jdbc/petclinic</value> </property> </bean> <bean id="transactionManager"

Spring+Mybatis 实现多数据源和多事物配置

耗尽温柔 提交于 2019-11-26 21:36:16
没有相应的RPC接口,一个项目存在多个数据源,不想在代码端自己编写代码切换数据源? 你有可能需要下面的解决方案: 多数据源配置 <!-- 数据源1配置 --> <bean id="dataSourceFor1" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" /> <property name="url" value="${db1_url}" /> <property name="username" value="$db1_user}" /> <property name="password" value="${db1_passwd}" /> <property name="maxWait" value="${db1_maxWait}" /> <property name="maxActive" value="28" /> <property name="initialSize" value="2" /> <property name="minIdle" value="0" /> <property name

分布式事务系列(开篇)提出疑问和研究过程

我们两清 提交于 2019-11-26 19:26:22
#1 前言 系列目录 分布式事务系列(开篇)提出疑问和研究过程 分布式事务系列(1.1)Spring事务管理器PlatformTransactionManager源码分析 分布式事务系列(1.2)Spring事务体系 分布式事务系列(2.1)分布式事务模型与接口定义 分布式事务系列(3.1)jotm的分布式案例 分布式事务系列(3.2)jotm分布式事务源码分析 分布式事务系列(4.1)Atomikos的分布式案例 对于我们这种初学者,可能会使用spring带给我们的@Transactional,可能了解JTA,可能会使用jotm、atomikos,又会遇到一些名词XA,支持XA的数据库驱动等等诸多问题,然后就会愈加混乱,自然形成一个疑问,庞大的事务体系的全貌到底是什么样? #2 需要解决的疑惑 下面就要具体列出一系列需要解决的问题 ##2.1 对于事务模型 三种事务模型是什么?各自的特点是什么?各自的缺陷是什么? ##2.2 spring对于事务模型的支持 spring自己的一系列接口设计: PlatformTransactionManager 事务管理器 TransactionDefinition 事务定义 TransactionStatus 事务状态 等等 上述一系列接口的实现是如何对非分布式和分布式事务的支持的呢? ##2.3 针对分布式事务的规范 X/Open

persistence.xml different transaction-type attributes

徘徊边缘 提交于 2019-11-26 12:49:39
问题 In the persistence.xml JPA configuration file, you can have a line like: <persistence-unit name=\"com.nz_war_1.0-SNAPSHOTPU\" transaction-type=\"JTA\"> or sometimes: <persistence-unit name=\"com.nz_war_1.0-SNAPSHOTPU\" transaction-type=”RESOURCE_LOCAL”> My question is: What is the difference between transaction-type=\"JTA\" and transaction-type=”RESOURCE_LOCAL” ? I also noticed some persistence.xml files with the transaction-type missing. Is it correct? 回答1: Defaults Default to JTA in a

How to use JTA support in Tomcat 6 for Hibernate?

倾然丶 夕夏残阳落幕 提交于 2019-11-26 12:09:22
问题 They recommend using JTA transaction support in Java EE environment. But how to configure JTA in Tomcat6 so that Hibernate Session could use it ? Starting with version 3.0.1, Hibernate added the SessionFactory.getCurrentSession() method. Initially, this assumed usage of JTA transactions, where the JTA transaction defined both the scope and context of a current session. Given the maturity of the numerous stand-alone JTA TransactionManager implementations, most, if not all, applications should

javax.transaction.Transactional vs org.springframework.transaction.annotation.Transactional

只愿长相守 提交于 2019-11-26 11:58:56
问题 I don\'t understand what is the actual difference between annotations javax.transaction.Transactional and org.springframework.transaction.annotation.Transactional ? Is org.springframework.transaction.annotation.Transactional an extension of javax.transaction.Transactional or they have totally different meaning? When should each of them be used? Spring @Transactinal in service layer and javax in DAO? Thanks for answering. 回答1: Spring has defined its own Transactional annotation to make Spring

Difference between a “jta-datasource” and a “ resource-local ” datasource?

百般思念 提交于 2019-11-26 11:48:29
问题 The terms \"jta-datasource\" and \"resource-local datasource\" are a little vague to me. I\'m putting down what I am understanding ( or assuming ) and I\'d like you to say where I\'m right / wrong. The same database can be referred to as a jta-datasource or as a resource local datasource If mentioned as jta-datasource, then the beans / other classes can use JTA. Hence, UserTransaction interface Cannot use CMT / BMT if the datasource is resource local If mentioned as resource local datasource,