Atomikos Forum

Websphere transaction manager and datasource migration to Atomik

We are trying to migrate Websphere to Tomcat where two essential components needs to be migrated. We migrated the connection pool management to Hikari and Transaction Management to Atomikos. Hibernate is not managed by Spring nor the datasource is managed by spring. The transaction management is provided by spring by injecting the atomikos implementation.

<bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.J2eeUserTransaction">
    <property name="transactionTimeout" value="180"/>

<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"
    <property name="transactionManager" ref="atomikosTransactionManager" />
    <property name="userTransaction" ref="atomikosUserTransaction" />
    <property name="allowCustomIsolationLevels" value="true" />
Hibernate config file is loaded separately and provided with the Hikari datasource and the transaction config class like below: com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup

We have not changed the autocommit flag in hikari which I think has a default value as true.

Websphere transaction manager was able to rollback any session updates but the above configuration is not able to. For example for the below code websphere transaction manager rolls back the transaction:

Session session = null;
session = factory.getSession();
String abc = null;
abc.length(); // line 8
catch(Exception e){
When the userTransaction is provided through Atomikos and Hikari is the datasource the transaction is not rollback after an exception at line 8.

I even tried with Websphere Transaction Manager and the Hikari datasource but still the transaction does NOT rolls back.

I cannot set the autocommit in Hikari as false as at a lot of places we dont use the transaction manager(begin) at all and just use session.saveOrUpdate. In case of websphere datasource it persists in the database but in case of Hikari then it wont persist(as autocommit is false).

Please help with any ideas how I can implement the same functionality as provided by Websphere by not impacting a lot of code in the system.
Vishal Singh Send private email
Thursday, June 22, 2017

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics