jta

Spring + Eclipselink + JtaTransactionManager = javax.persistence.TransactionRequiredException

核能气质少年 提交于 2019-12-08 09:10:36
问题 I really hope you can help me. I've been looking all over the internet for answers and none of them works. I use Spring 3 + JTA + EclipseLink but i'm getting a TransactionRequiredException when flushing a transaction. Now i'm very used to just defining my persistence context and injecting the EntityManager and the transaction is handled by the app server. So here's what I've got. persistence.xml <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3

How to change value of com.arjuna.ats.jbossatx.jta.TransactionManagerService TransactionTimeout at the run-time?

一曲冷凌霜 提交于 2019-12-08 09:10:24
问题 We have JBoss [EAP] 4.3.0.GA_CP01 environment and I need to modify the TransactionTimeout property of com.arjuna.ats.jbossatx.jta.TransactionManagerService but whenever i try to change the value via MBean from JMX-Console; following stacktrace shows up: java.lang.IllegalStateException: Cannot set transaction timeout once MBean has started com.arjuna.ats.jbossatx.jta.TransactionManagerService.setTransactionTimeout(TransactionManagerService.java:323) sun.reflect.NativeMethodAccessorImpl.invoke0

Is it possible to set up parallel transactions in JTA (Atomikos)

旧城冷巷雨未停 提交于 2019-12-08 07:02:32
问题 I have two transactional resources, database and message queue. So I use Atomikos as the XA transaction manager. Inside a transaction (tx1), is it possible to open another separated transaction (tx2) in parallel? In tx2, it will commit some data into db, even the tx1 might be failed and roll backed eventually. And tx2 must be done inside tx1, as if error occurred in tx2 should roll back the tx1 also. Anyone knows how I can achieve this? Thank you. 回答1: Yes, you can achive this. You talk about

Implement custom JTA XAResource for using with hibernate

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 04:28:25
问题 I have two level access to database: the first with Hibernate, the second with JDBC. The JDBC level work with nontransactional tables (I use MyISAM for speed). I want make both levels works within transaction. I read about JTA which can manage distributed transactions. But there is lack information in the internet about how to implement and use custom resource. Does any one have experience with using custom XAResources? 回答1: I want make both levels works within transaction. Then you'll have

How to use JDBC in JavaEE?

隐身守侯 提交于 2019-12-07 18:50:11
问题 I'm developing in a JavaEE environment (weblogic 12), and part of my code uses JDBC; Therefore, I need to aqcuire a JDBC connection from the application server. I know it's a really bad practice to use JDBC in JavaEE, but that's a code I cannot change (legacy). I've found a way to do it, but I'm not sure it's the right way: @Resource(mappedName="mydsjndipath") private DataSource ds; public void foo() { Connection conn = ds.getConnection(); } The question is what do I do with the connection at

hibernate.current_session_context_class属性配置

岁酱吖の 提交于 2019-12-07 10:53:45
此设置的作用如下: What does sessionFactory.getCurrentSession() do? First, you can call it as many times and anywhere you like, once you get hold of your SessionFactory (easy thanks to HibernateUtil). The getCurrentSession() method always returns the "current" unit of work. Remember that we switched the configuration option for this mechanism to "thread" in hibernate.cfg.xml? Hence, the scope of the current unit of work is the current Java thread that executes our application. However, this is not the full truth. A Session begins when it is first needed, when the first call to getCurrentSession() is

What do I need to do to integrate JTA into a Java SE application?

安稳与你 提交于 2019-12-07 07:04:54
问题 Suppose I want to implement an application container. Not a full-on Java EE stack, but I need to provide access to JDBC resources and transactions to third party code that will be deployed in an application I'm writing. Suppose, further, that I'm looking at JBossTS for transactions. I'm not settled on it, but it seems to be the best fit for what I need to do, as far as I can tell. How do I integrate support for providing connection resources and JTA transactions into my Java SE application?

hibernate.current_session_说明

狂风中的少年 提交于 2019-12-06 19:08:12
遇到过的问题: 情景1: 在使用SessionFactory的getCurrentSession方法时遇到如下错误,经过检查,原因如下: 是因为在hibernate.cfg.xml文件中忘记进行了如下设置: hibernate.current_session_context_class如果是在web容器中运行hibernate,则在hibernate.cfg.xml中加入这句话: <property name="hibernate.current_session_context_class">jta</property> 如果是在一个单独的需要进行JDBC连接的java application中运行hibernate,则这样设置: <property name="hibernate.current_session_context_class">thread</property> 情景2: 在ssh2中的sessionFactory配置文件中 应将hibernate.current_session_context_class设为org.springframework.orm.hibernate3.SpringSessionContext(默认为此值) 并应用spring管理事务。如果为<prop key="hibernate.current_session_context_class

Is it possible to set up parallel transactions in JTA (Atomikos)

空扰寡人 提交于 2019-12-06 15:44:25
I have two transactional resources, database and message queue. So I use Atomikos as the XA transaction manager. Inside a transaction (tx1), is it possible to open another separated transaction (tx2) in parallel? In tx2, it will commit some data into db, even the tx1 might be failed and roll backed eventually. And tx2 must be done inside tx1, as if error occurred in tx2 should roll back the tx1 also. Anyone knows how I can achieve this? Thank you. Yes, you can achive this. You talk about so named "nested" transaction First of all for Atomikis you must specify property com.atomikos.icatch

Differences between javax.jms.ConnectionFactory and javax.jms.XAConnectionFactory

跟風遠走 提交于 2019-12-06 13:57:28
I'm entering the world of JTA, due to need of distributed transactions, and I'm uncertain about the differences between javax.jms.ConnectionFactory and javax.jms.XAConnectionFactory or more accurately how can it be that javax.jms.ConnectionFactory performed what I expected only javax.jms.XAConnectionFactory can do for me. The details: I'm using Atomikos essentials as my transaction manager and my app is running on Apache Tomcat 6. I'm running a small POC with a dummy app where I have my JMS provider ( OpenMQ ) registered as a JNDI resource. <Resource name="jms/myConnectionFactory" auth=