import javax.transaction.*;
public class ExampleTransactionManager {
public static void main(String[] args) {
TransactionManager transactionManager = com.arjuna.ats.jta.TransactionManager.transactionManager();
try {
transactionManager.begin();
// ...
// ...
transactionManager.commit();
} catch (Exception e) {
try {
transactionManager.rollback();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd">
<bean id="transactionManager" class="com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple"/>
<tx:jta-transaction-manager/>
<tx:annotation-driven/>
<!-- ... -->
</beans>