jta

Is it possible to use more than one persistence unit in a transaction, without it being XA?

主宰稳场 提交于 2019-12-10 20:56:10
问题 Our application needs to use (read-only) a couple different persistence units pointing to different databases (different, commercial vendors as well). We do not have the budget to enable 2pc on one of them (Sybase). Is there a way to use these in a transaction without it having to be an XA transaction? We're using Websphere 6.1, Sybase 12.5.3, Oracle 10g, Java EE 5, and JPA with Hibernate Entity Manager. Update: The oracle PU is updated rarely 1 or 2 per month, the sybase PU is updated very

JTA Datasources without transactions

柔情痞子 提交于 2019-12-10 19:32:26
问题 (Assuming manual enlistment and delistment of resources.) I have a number of XA enabled resources/datasource for which I plan to perform transactional updates. Additionally, some of the XA-enabled datasources can be updated in isolation (without requiring any other resource). Assuming I have already committed a number of transactions with a datasource enlisted, can I then ignore the TransactionManager for unilateral updates to the datasource. Do I simply not start a global transaction and

Problem creating JPA EntityMananger in Spring Context

不打扰是莪最后的温柔 提交于 2019-12-10 17:29:51
问题 I have a JPA/Spring application that uses Hibernate as the JPA provider. In one portion of the code, I have to manually create a DAO in my application with the new operator rather than use Spring DI. When I do this, the @PersistenceContext annotation is not processed by Spring. In my code where I create the DAO I have an EntityManagerFactory which I used to set the entityManager as follows: @PersistenceUnit private EntityManagerFactory entityManagerFactory; MyDAO dao = new MyDAOImpl(); dao

Strange Atomikos exception - Error in init(): Log already in use?

天涯浪子 提交于 2019-12-10 12:38:07
问题 We're trying to run the same web application that uses Atomikos as transaction manager on several local envrionments (each of those uses the same versions of spring, atomikos, tomact etc with the same configuration files). Some of them work fine, but in one of them, when we try to to start tomcat we get the following exception: Caused by: java.lang.IllegalStateException: Can't overwrite cause with java.lang.RuntimeException: Log already in use? at java.lang.Throwable.initCause(Throwable.java

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

Deadly 提交于 2019-12-10 11:04:44
问题 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

How to fix HSQL DataSource + TxM where identity always return 0

谁都会走 提交于 2019-12-10 10:59:55
问题 I am using Hibernate to do my ORM stuff w/ HSQL for tests. It seems that a connection is fetched to do the insert and then returned. Straight after that HIbernate gets a connection then tries to fetch the identity from HSQL but that returns 0 which is obviously wrong. WHen i was running w/out a tm and datasource using a plain pooled connection everything worked but with the new tm + ds i am getting this problem. 回答1: The answer is the DataSource should be tx aware, so that connections are

Wildfly 8.0.0.Final JTA transaction issues

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 10:06:55
问题 Since we use a lot of @ApplicationScoped beans with transaction but we do not want to use EJBs (ApplicationScoped bean does not work with stateless beans), we create our own transaction interceptor such as: @Resource UserTransaction tx; @Resource(mappedName="java:jboss/TransactionSynchronizationRegistry") TransactionSynchronizationRegistry tsr; @AroundInvoke public Object manageTransaction(InvocationContext context) throws Exception { Object result; if (Status.STATUS_NO_TRANSACTION == tsr

How to use Container Managed Transaction (CMT) with JBoss AS 6, Hibernate 3.6, JPA, JTA and EJB3

浪子不回头ぞ 提交于 2019-12-10 09:27:53
问题 I'm attempting to setup a web app using CMT. I've got it running standalone within Eclipse ok, and now I'm trying to get it working within Jboss AS 6, using Struts 1.0. I've chosen CMT because the doco I've read hints that it's the best and "least verbose to use". So seems like contempory/good-practice use of Hibernate 3.6. I can load objects from a MySQL database with the following code extracts, but persisted objects are not being flushed/synchronised/saved to the database: From within

What is a global transaction?

℡╲_俬逩灬. 提交于 2019-12-10 04:28:29
问题 JSR 907 JTA 1.2 defines the "global transaction" term: The UserTransaction.begin method starts a global transaction and associates the transaction with the calling thread. What does that mean? Is it the outermost transaction or what? 回答1: Basically the difference between a local transaction and a global transaction is resource bound. A global transaction will span multiple resources. A local transaction is limited to one resource/datasource. E.g. In a global transaction you will write to the

IllegalStateException: Cannot use an EntityTransaction while using JTA

前提是你 提交于 2019-12-08 11:06:15
问题 I'm making a project for school using JPA. I'm trying to persist an object but I'm getting an error I can't fix. I've read that I have to use usertransaction instead of entitytransaction but we didn't get much information during this lesson so I don't know a lot about this topic. How can I fix this error and be able to persist it? This is the error I get: java.lang.IllegalStateException: Exception Description: Cannot use an EntityTransaction while using JTA. Here is the code that I use: