Atomikos Forum

All feedback will be investigated, but priority support, confidential support, and product priority updates are reserved for customers. Interested in becoming a customer? Subscribe here...

Only registered users can post (registration is free). Problems registering? Send an email to support@atomikos.com to get help.


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>

<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"
    depends-on="atomikosTransactionManager,atomikosUserTransaction">
    <property name="transactionManager" ref="atomikosTransactionManager" />
    <property name="userTransaction" ref="atomikosUserTransaction" />
    <property name="allowCustomIsolationLevels" value="true" />
</bean>
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;
try{
userTransactionService.begin();
session = factory.getSession();
session.saveorUpdate(acccount);
session.flush();
String abc = null;
abc.length(); // line 8
userTransactionService.commit();
}
catch(Exception e){
 userTransactionService.rollback();
}
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
donderdag 22 juni 2017
 
 

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

Other recent topics Other recent topics
 
Powered by FogBugz