Intercept transaction only when is sure to be committed but before is committed

前端 未结 2 2226
谎友^
谎友^ 2021-02-12 23:36

Context is Java - JPA with Hibernate and Spring.

Let\'s take the scenario of two-phase commit protocol (but only with one resource):

  1. Query to commit fro

2条回答
  •  青春惊慌失措
    2021-02-13 00:30

    Your case is that one of your resource is not compatible with two-phase-commit (not XA-capable). Your idea goes in the direction of the pattern described in paragraph XA and the Last Resource Gambit of http://www.javaworld.com/article/2077963/open-source-tools/distributed-transactions-in-spring--with-and-without-xa.html

    The use of the last resource gambit is briefly explained in the answer of How to set up Spring Boot + Bitronix + non-XA Datasource + XA JMS Connection

    By the way, your question doesn't mention which implementation of a transaction manager you use (JBossTS, Bitronix JTA, Atomikos Transaction Essentials, ...).

提交回复
热议问题