jta

JTA Synchronization and Timeouts

When using the Java Transaction API (JTA) and I register a Synchronization with the current transaction, will the afterCompletion() method be called if the transaction times out? If so, when will the afterCompletion() method be called, i.e. as soon as the transaction runs over the allotted timeout value or when the first operation on th...

Spring/JTA/JPA DAO integration test doesn't rollback?

My DAO integration tests are failing because entities created during the tests are still in the database at the start of the next test. The exact same behavior is seen from both MySQL 5 and H2. The test classes are annotated with: @Transactional @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration( { "/testPersist-application...

Rerunning failed Container-Managed transactions in JEE

I have a situation with a legacy system which uses JEE Bean Managed Transactions. It's getting LockAcquisitionException thrown when it's trying to retrieve something it just created. My initial thoughts were this: @TransactionAttribute(SUPPORTS) public Item retrieveItem(int id) { Item i; try { i = em.find(Item.class, id); } catch...

Transactions (Atomicity property) in EJB 3 apply only to Database Operations - Am I right?

I know that transactions could be used to bring about atomicity. Like if methodOne() methodTwo() methodThree() are clubbed into one transaction, if any of the method fails, the entire operation is rolled back. A rollback would result in a database-level rollback and as a result the database would be brought to a state, as it was before...

Can BMT transaction join with an existing transaction ?

I find that in a session bean, while using Container-Managed-Transactions, the transaction can be made to join with the existing client-transaction using transactional attributes like REQUIRED / SUPPORTS. While using Bean-Managed-Transaction, is there a way to make that transaction join with the existing client-transaction ? ...

Difference between a "jta-datasource" and a " resource-local " datasource ?

Hi, The terms "jta-datasource" and "resouce-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 / o...

Simple JOTM Questions

I'm starting to use JOTM and have a few simple questions: If I start an embedded JOTM instance, can I perform a 2 phase commit between a remote database (with an XA enabled driver) and a local JMS queue initiated by a 3rd party client? Does my JOTM instance require both the Database and JMS provider .jar files on the classpath if a rem...

Get OracleXADataSource using InitialContext

Hi everyone, i'm developing an application running on WebLogic 10 and of course in java. Ok, the thing is that i'm using oracle.jdbc.xa.client.OracleXADataSource to manage the transactions, and i'm also trying to set the OracleXADataSource object with InitialContext like this: InitialContext ctx = new InitialContext(); Oracle...

Detected reentrant flush in JPA

Hi I m using JPA to insert a row My update code as in here Now i m inserting a row using this code public void get_image (String id) { Object l = null; try { em = this.getEm(); EntityTransaction entr = em.getTransaction(); entr.begin(); newa.Options o = new newa.Options(); newa....

ejb3-using-2-persistence-units-within-a-transaction

I am having problems connecting to 2 persistence units from within the same transaction using following tech stack, WLS 10.3.x, Eclipselink 2.1, Oracle 11g JDBC driver, Informix 10 JDBC driver Using inputs from this SO post I made the oracle datasource XA compliant and the Informix ds "Emulate 2-phase commit" and things started to work...

WebSphere local transaction containment boundary issue J2CA0086W

In WebSphere, if you code opens two concurrent database connections, you get an error of the form: J2CA0086W: Shareable connection MCWrapper id 556e556e Managed connection WSRdbManagedConnectionImpl@52365236 State:STATE_TRAN_WRAPPER_INUSE from resource jdbc/abc was used within a local transaction containment boundary. Our framework ...

Setting Transaction Isolation Level in Berkeley DB Java Edition for Distributed Transactions (XA)

I am using distributed transactions in a BDB JE application to coordinate transactions across multiple BDB JE environments. I want to set the transaction isolation level to serializable. To begin distributed transactions, I use an Xid that I generate and have to ensure is globally unique, eschewing BDB JE's native Transaction class. T...

Difference between JTA, JPA and Plain JDBC in hibernate

Hi, Can anyone tell me what is the difference between JTA, JPA, and Plain JDBC in terms of hibernate? I have been asked continuously this question and I fumble while giving the answer. Best Regards, Aashutosh ...

How to enable custom isolation levels for a JTA Transaction Manager in Spring

Question How do I configure a JtaTransactionManager object with allowCustomIsolationLevels set to true via Spring such that the Spring configuration can be used across multiple application servers? Background: I have an application that is currently running out of JBossAS and I'm trying to get it to run in WebSphere. The only issue I'...

Hibernate session.close() not returning connection to pool

My application has long running transactions and hence I tried the option session.close() at the end of every method to ensure that the connection objects are not held indefinitely for long time. When session.close() option is used, I could see that the Hibernate's session object and the corresponding Connection object obtained from se...

unit testing code which uses JPA & JTA

I use 2 separate database, so i have to use JTA to handle distributed transactions.So either either both db have to commit or both rollback. I use open JPA and JTA.Now to unit test the code using junit ? I get the following error when i try to run my code which handles distributed transcations.I had posted similar question on this sit...

How to wrap an object change in my own transaction and incorporate it with Hibernate to JTA?

I have a web-app, which I deploy on Tomcat 6 and it uses Hibernate. It receives messages on a JMS queue which trigger changes both to my DB, via Hibernate and to an Object of mine (Agent). The web-requests also access the DB, via Hibernate, and access the shared object (there's a ConcurrentHashMap<AgentId,Agent> held by a singleton). My ...

Can I use JTA over different EARs which are deployed to different servers?

Hi, I'm looking into JTA as I need distributed transactions (across JPA, JMS and EHCache). I'm trying to understand whether JTA can supply an additional functionality which I'm considering. If I have 3 different servers, each running Glassfish and each server has a different EAR (a different module of mine). Can I have a transaction whic...

What are JTA best-practices and anti-patterns?

Hi, I'm looking into JTA and I'd appreciate hearing about best-practices as well as anti-patterns for multi-threaded applications. Thanks, Ittai ...

Concurrency issue in JPA and JTA

Possible Duplicate: concurrency (stale data) problem in JPA Sorry for duplicating, but I think I didn't get satisfactory answers so posting again Let's say I have methods with following signature Object getData(int id) { //create a entity manager //get data frm db //return data } updateData() { Object obj = getData...