我有一个已配置的nirayana独立JTA和两个REST端点
开始交易
使用交易
@GetMapping("/starttx")
public String starttx() throws NotSupportedException, SystemException
{
// TransactionManager transactionManager = com.arjuna.ats.jta.TransactionManager.transactionManager();
UserTransaction userTransaction = com.arjuna.ats.jta.UserTransaction.userTransaction();
System.out.println(userTransaction);
userTransaction.begin();
System.out.println(userTransaction.getStatus());
System.out.println("trx started");
return "started";
}
@GetMapping("/createAccount")
// @Transactional(rollbackFor=RuntimeException.class)
public String account() throws SystemException
{
UserTransaction userTransaction = com.arjuna.ats.jta.UserTransaction.userTransaction();
System.out.println(userTransaction.getStatus());
em.persist(new AccountEntity("acc1"));
return "created account";
}
我分别调用starttrx和createAccount,但是在createAccount中,事务状态为6,这意味着它不处于活动状态,如何与createAccount共享在starttx端点中创建的事务?