Why nested transactions are not supported in JTA

前端 未结 3 1441
隐瞒了意图╮
隐瞒了意图╮ 2021-01-02 07:27

Why aren\'t nested transactions supported by JTA? Is it because of the complexity of implementing them (which I doubt) or some design principle?

3条回答
  •  我在风中等你
    2021-01-02 08:02

    JTA specification is not saying that the it doesn't support the nested transactions - it just doesn't require the implementors to support it.

    Following excerpts are taken from the JTA 1.1 spec:

    p. 11, 13; 3.1 UserTransaction interface and 3.2 TransactionManager interface

    "Support for nested tranactions is not required."

    p. 13, 3.2.1 Starting a Transaction

    "If the Transaction Manager implementation does not support nested transactions, the TransactionManager.begin method throws the NotSupportedException when the calling thread is already associated with a transaction."

    There might be actually a problem with the XAResource that you might try enlisting with the current transaction (I believe it might be related with the X/Open XA specification):

    3.4.4 Transaction Association

    XAResource does not support nested transactions. It is an error for the XAResource.start method to be invoked on a connection that is currently associated with a different transaction.

提交回复
热议问题