views:

51

answers:

1

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. However, now I am getting a strange problem.

I am using standalone java client to invoke my ejb 3 SLSB which in turn invokes the JPA entities. The problem I am facing is it works the first time, the second time it does not throw any exception but does not update the data in either databases and the 3rd time it throws an exception stating "Transaction has already been committed" as if the application server JTA transaction manager is holding on to the original transaction context. Please note these 3 invocations are separate and sequential wherein every invocations completes with the client exiting the client process. The problem is very consistent and happens in the exact same sequence every time I restart the app server.

Appreciate any input!

A: 

<persistence-unit name="TopLinkDB" transaction-type="JTA"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> <jta-data-source>jdbc/oracleDS</jta-data-source> <class>com.home.domain.Property</class> <properties> <property name="eclipselink.target-server" value="WebLogic_10" /> </properties> </persistence-unit>
<persistence-unit name="TopLinkINFO" transaction-type="JTA"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> <jta-data-source>jdbc/infoDS</jta-data-source> <class>com.home.domain.GlobalNumber</class> <properties> <property name="eclipselink.target-server" value="WebLogic_10" /> </properties> </persistence-unit>

hbagchi