jta

Why nested transactions are not supported in JTA

喜你入骨 提交于 2019-11-30 13:03:07
Why aren't nested transactions supported by JTA? Is it because of the complexity of implementing them (which I doubt) or some design principle? Stephen C (As @Piotr Nowicki points out, JTA does allow nested transactions, but this is optional not mandatory.) Why? This is one of those questions that is impossible to answer with any certainty, unless you were one of the people "in the room" when the decisions were made. It could be the inherent complexity of including nested transactions as part of the spec. Or apparent complexity at the time; i.e. they weren't sure they knew how to do a good job

Transactional annotation on whole class + excluding a single method

此生再无相见时 提交于 2019-11-30 11:08:31
I have a class with @Transactional annotation (instead of marking it for all of its method). Although i have a single method inside that class that shouldn't be annotated as @Transactional . My question is is there an annotation i can put in this method to mark it as "non-transactional"? or should i start marking each single method in this class as "transactional" excluding this method (a lot of work) thanks. Sotirios Delimanolis There are different transaction propagation strategies to use. These exist in the enum Propagation . The ones you might want to use are /** * Execute non

Spring JTA configuration - how to set TransactionManager?

为君一笑 提交于 2019-11-30 11:06:41
问题 We configure our Spring transaction in Spring config as: <tx:jta-transaction-manager/> I gather this means that Spring will automatically discover the underlying JTA implementation. So when we start up JBoss we see these messages while Spring searches: [JtaTransactionManager] [ ] No JTA TransactionManager found at fallback JNDI location [java:comp/Tran sactionManager] javax.naming.NameNotFoundException: TransactionManager not bound <<Big stack trace>> <<More of the same>> And then eventually

Is there an open-source solution to XA-transactional file access in Java?

纵饮孤独 提交于 2019-11-30 05:25:46
Is it possible to make XA-transactional access to the file system in Java? I want to manipulate files within the boundaries of a transaction and my transaction must participate in a distributed transaction via JTA (so I guess the file system needs to be accesses as a XAResource). I don't need support for fine-grained read/write file access; treating each file as a record is good enough for my needs. Does anybody know an open-source project that already does this? I don't feel like implementing this mess just to find out that it's already been done... I heard some rumors that JBoss Transcations

dynamically register transaction listener with spring?

此生再无相见时 提交于 2019-11-30 03:51:55
I have a springframework application in which I would like to add a transaction listener to a transaction which is currently in progress. The motivation is to trigger a post commit action which notifies downstream systems. I am using @Transactional to wrap a transaction around some service method -- which is where I want to create/register the post transaction listener. I want to do something "like" the following. public class MyService { @Transaction public void doIt() { modifyObjects(); // something like this getTransactionManager().registerPostCommitAction(new

Spring JTA configuration - how to set TransactionManager?

不问归期 提交于 2019-11-29 23:17:48
We configure our Spring transaction in Spring config as: <tx:jta-transaction-manager/> I gather this means that Spring will automatically discover the underlying JTA implementation. So when we start up JBoss we see these messages while Spring searches: [JtaTransactionManager] [ ] No JTA TransactionManager found at fallback JNDI location [java:comp/Tran sactionManager] javax.naming.NameNotFoundException: TransactionManager not bound <<Big stack trace>> <<More of the same>> And then eventually see: [JtaTransactionManager] [ ] JTA TransactionManager found at fallback JNDI location [java:

When does @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) commit?

我是研究僧i 提交于 2019-11-29 22:17:58
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? Petr Mensik 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, methods called from the same bean do not act as a business methods. See this great article for

Why different persistence units with separated data sources query the same data source?

心已入冬 提交于 2019-11-29 20:42:49
I'm developing a webapp which needs access to two different database servers (H2 and Oracle). The container is an Apache Tomee 1.5.1 and I'm using the Java EE stack with libraries provided in it (JSF, JPA, CDI, EJB, etc.). I'm trying to use two entity managers inside an XA transaction to extract data from the Oracle database and persist it in the H2 after transforming it, BUT all the queries are executed against the H2 database no matter the entity manager I use. Any help? EDIT : I found that if I try to access the entity managers in inverse order, they behavior is the same but accessing to

What is the difference between JTA and a local transaction?

六眼飞鱼酱① 提交于 2019-11-29 18:45:42
What is the difference between JTA and a local transaction? An example that shows when to use JTA and when to use a local transaction would be great. JTA is a general API for managing transactions in Java. It allows you to start, commit and rollback transactions in a resource neutral way. Transactional status is typically stored in TLS (Thread Local Storage) and can be propagated to other methods in a call-stack without needing some explicit context object to be passed around. Transactional resources can join the ongoing transaction. If there is more than one resource participating in such a

how to share one transaction between multi threads

对着背影说爱祢 提交于 2019-11-29 18:11:01
问题 We meet an scenario that works with multi thread. In the main Thread, do some logic and update the database, in a point, it will call another service to update database, which is run in another Thread. We want the two Threads share the same transaction, that means, either operation in either Thread fails, then the operation in another Thread will also be rolled back. But work for several days, I found some posts say JTA does not support the multi Thread. currently we use Bitronix as the JTA