jta

How to manage transaction for database and file system in Java EE environment?

陌路散爱 提交于 2019-11-28 19:40:43
I store file’s attributes (size, update time…) in database. So the problem is how to manage transaction for database and file. In a Java EE environment, JTA is just able to manage database transaction. In case, updating database is successful but file operation fails, should I write file-rollback method for this? Moreover, file operation in EJB container violates EJB spec. What’s your opinion? Access to external resources such as a file system should ideally go through a JCA connector . Though there are several posts around discussing this, I never found a ready-to-use JCA connector for

When does @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) commit?

为君一笑 提交于 2019-11-28 18:56:23
问题 An EJB method named Aby calls another EJB method named Bob Bob is marked with @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) When does bob transaction commits?: a) when bob invocation ends b) when aby invocation ends c) other. when? 回答1: I think A is right. When the method Bob is being called, it creates new transaction for it and method Aby gets suspended until the Bob transaction is committed. Also note that it has to be method from some other bean to make it transactional,

What is a good open source Java SE JTA TransactionManager implementation? [closed]

淺唱寂寞╮ 提交于 2019-11-28 18:43:53
Basically, what it says on the tin; I need a JTA implementation useable in a Java SE application, ideally one that doesn't carry too much of a framework burden with it. erickson I recommend Bitronix . Before using any other transaction manager, I recommend thorough testing. Tests like killing power to various machines during each phase of the transaction. You want transactionality to protect you when failures occur. It is surprising how many transaction managers have failed to correctly implement recovery. Bitronix does need JNDI, which is typically provided for you in a Java EE container, but

How to design global distributed transaction(none database)? Can JTA use for none db transaction?

怎甘沉沦 提交于 2019-11-28 18:23:47
I think this is a fairly common question: how to put my business logic in a global transaction in distributed systems environment? Cite an example, I have a TaskA containing couples of sub tasks: TaskA {subtask1, subtask2, subtask3 ... } each of these subtasks may execute on local machine or a remote one, I hope TaskA executes in an atomic manner(success or fail) by means of transaction. Every subtask has a rollback function, once TaskA thinks the operation fails(because one of subtask fails), it calls each rollback function of subtasks. Otherwise TaskA commits the whole transaction. To do

What is difference between @Resource UserTransaction and EntityManager.getTransaction()

老子叫甜甜 提交于 2019-11-28 17:51:13
Can anybody explain what is difference between : @Resource UserTransaction objUserTransaction; and EntityManager.getTransaction(); And also what is container managed transaction? and how should I do it in my session facade if I want to insert three rows in table in transaction. ewernli EJB are transactional components. The transaction can be managed either by the applicaiton server itself (CMT - container-managed transaction), or manually by yourself within the EJB (BMT - bean-managed transaction). EJB supports distributed transaction through the JTA specification. The distributed transaction

Cannot use an EntityTransaction while using JTA

大兔子大兔子 提交于 2019-11-28 11:58:28
I'm receiving this error: javax.servlet.ServletException: java.lang.IllegalStateException: Exception Description: Cannot use an EntityTransaction while using JTA. While trying to use JPA and JAVAEE, Glassfish. My persistence.xml file is as follow: <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="acmeauction"> <provider>org.eclipse

分布式事务系列(2.1)分布式事务的概念

时光怂恿深爱的人放手 提交于 2019-11-28 11:04:10
#1 系列目录 分布式事务系列(开篇)提出疑问和研究过程 分布式事务系列(1.1)Spring事务管理器PlatformTransactionManager源码分析 分布式事务系列(1.2)Spring事务体系 分布式事务系列(2.1)分布式事务模型与接口定义 分布式事务系列(3.1)jotm的分布式案例 分布式事务系列(3.2)jotm分布式事务源码分析 分布式事务系列(4.1)Atomikos的分布式案例 #2 X/Open DTP DTP全称是Distributed Transaction Process,即分布式事务模型。之前我们接触的事务都是针对单个数据库的操作,如果涉及多个数据库的操作,还想保证原子性,这就需要使用分布式事务了。而X/Open DTP就是一种分布式事务处理模型。 ##2.1 X/Open DTP模型 X/Open是一个组织,维基百科上这样说明: X/Open是1984年由多个公司联合创建的一个用于定义和推进信息技术领域开放标准的公司 上述组织就针对分布式事务提出了一个模型,即DTP模型(Distributed Transaction Process),该模型如下所示: 上面主要涉及了三个对象: AP(Application Program):应用程序 TM(Transaction Manager):事务管理器 负责协调和管理事务

JTA

白昼怎懂夜的黑 提交于 2019-11-28 08:33:30
概念 java事务API(Java Transaction API,简称JTA)是一个Java企业版的应用程序接口。不过JTA只是提供了一个接口,并没有提供具体的实现。 常见的JTA实现如下 J2EE容器所提供的JTA实现(JBoss) 独立的JTA实现:如JOTM,Atomikos 二阶段提交协议 将各个库视为参与者,而将分布式事物管理器视为协调者 协调者对各参与者发起预提交请求 各参与者预提交后向协调者确认可以提交 协调者再对各参与者发起提交请求 各参与者提交事务,并向协调者确认提交成功 上述期间任何错误,都有可能造成各库数据全部回滚 三阶段提交协议(两阶段提交的升级版) JTA的缺点 实现复杂,通常情况下,JTA UserTransaction需要从JNDI获取 JTA本身就是个笨重的API 通常JTA只能在应用服务器环境下使用,因此使用JTA会限制代码的复用性 JTA在实际开发中并不常用,业内主要采用MQ等异步方式解决一致性问题 来源: https://blog.csdn.net/xuanyuanjiaqi/article/details/100045164

Missing javax.transaction.jta artifact

南楼画角 提交于 2019-11-28 08:17:06
I am getting this missing artifact message for javax.transaction:jta:jar:1.0.1B as 403 Forbidden Multiple annotations found at this line: - Missing artifact javax.transaction:jta:jar:1.0.1B - ArtifactTransferException: Failure to transfer javax.transaction:jta:jar:1.0.1B from http:// repository.jboss.com/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of jboss has elapsed or updates are forced. Original error: Could not transfer artifact javax.transaction:jta:jar:1.0.1B from/to jboss (http://repository.jboss.com/maven2): Access denied to

How to use Atomikos Transaction Essentials with Hibernate >= 4.3

余生长醉 提交于 2019-11-28 07:44:30
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> <property name="current_session_context_class">jta</property> <property name="transaction.manager_lookup