Example usage for org.springframework.transaction.jta UserTransactionAdapter UserTransactionAdapter

List of usage examples for org.springframework.transaction.jta UserTransactionAdapter UserTransactionAdapter

Introduction

In this page you can find the example usage for org.springframework.transaction.jta UserTransactionAdapter UserTransactionAdapter.

Prototype

public UserTransactionAdapter(TransactionManager transactionManager) 

Source Link

Document

Create a new UserTransactionAdapter for the given TransactionManager.

Usage

From source file:com.baomidou.hibernateplus.HibernateConfigurableJtaPlatform.java

/**
 * Create a new ConfigurableJtaPlatform instance with the given
 * JTA TransactionManager and optionally a given UserTransaction.
 *
 * @param tm  the JTA TransactionManager reference (required)
 * @param ut  the JTA UserTransaction reference (optional)
 * @param tsr the JTA 1.1 TransactionSynchronizationRegistry (optional)
 *//*  w  ww .j  a  va2s  .  c o  m*/
public HibernateConfigurableJtaPlatform(TransactionManager tm, UserTransaction ut,
        TransactionSynchronizationRegistry tsr) {
    Assert.notNull(tm, "TransactionManager reference must not be null");
    this.transactionManager = tm;
    this.userTransaction = (ut != null ? ut : new UserTransactionAdapter(tm));
    this.transactionSynchronizationRegistry = tsr;
}

From source file:org.springframework.transaction.jta.SpringJtaSynchronizationAdapter.java

/**
 * Create a new SpringJtaSynchronizationAdapter for the given Spring
 * TransactionSynchronization and JTA TransactionManager.
 * <p>Note that this adapter will never perform a rollback-only call on WebLogic,
 * since WebLogic Server is known to automatically mark the transaction as
 * rollback-only in case of a {@code beforeCompletion} exception. Hence,
 * on WLS, this constructor is equivalent to the single-arg constructor.
 * @param springSynchronization the Spring TransactionSynchronization to delegate to
 * @param jtaTransactionManager the JTA TransactionManager to use for rollback-only
 * setting in case of an exception thrown in {@code beforeCompletion}
 * (can be omitted if the JTA provider itself marks the transaction rollback-only
 * in such a scenario, which is required by the JTA specification as of JTA 1.1)
 *///from  ww w.  j a  va 2  s  . com
public SpringJtaSynchronizationAdapter(TransactionSynchronization springSynchronization,
        @Nullable TransactionManager jtaTransactionManager) {

    this(springSynchronization);
    if (jtaTransactionManager != null && !jtaTransactionManager.getClass().getName().startsWith("weblogic.")) {
        this.jtaTransaction = new UserTransactionAdapter(jtaTransactionManager);
    }
}