Java Code Examples for org.springframework.transaction.TransactionDefinition#getIsolationLevel()

The following examples show how to use org.springframework.transaction.TransactionDefinition#getIsolationLevel() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EclipseLinkJpaDialect.java    From spring-analysis-note with MIT License 9 votes vote down vote up
@Override
@Nullable
public Object beginTransaction(EntityManager entityManager, TransactionDefinition definition)
		throws PersistenceException, SQLException, TransactionException {

	if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) {
		// Pass custom isolation level on to EclipseLink's DatabaseLogin configuration
		// (since Spring 4.1.2)
		UnitOfWork uow = entityManager.unwrap(UnitOfWork.class);
		uow.getLogin().setTransactionIsolation(definition.getIsolationLevel());
	}

	entityManager.getTransaction().begin();

	if (!definition.isReadOnly() && !this.lazyDatabaseTransaction) {
		// Begin an early transaction to force EclipseLink to get a JDBC Connection
		// so that Spring can manage transactions with JDBC as well as EclipseLink.
		entityManager.unwrap(UnitOfWork.class).beginEarlyTransaction();
	}

	return null;
}
 
Example 2
Source File: Neo4jTransactionUtils.java    From sdn-rx with Apache License 2.0 6 votes vote down vote up
/**
 * Maps a Spring {@link TransactionDefinition transaction definition} to a native Neo4j driver transaction.
 * Only the default isolation leven ({@link TransactionDefinition#ISOLATION_DEFAULT}) and
 * {@link TransactionDefinition#PROPAGATION_REQUIRED propagation required} behaviour are supported.
 *
 * @param definition The transaction definition passed to a Neo4j transaction manager
 * @return A Neo4j native transaction configuration
 */
static TransactionConfig createTransactionConfigFrom(TransactionDefinition definition) {

	if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) {
		throw new InvalidIsolationLevelException(
			"Neo4jTransactionManager is not allowed to support custom isolation levels.");
	}

	int propagationBehavior = definition.getPropagationBehavior();
	if (!(propagationBehavior == TransactionDefinition.PROPAGATION_REQUIRED || propagationBehavior == TransactionDefinition.PROPAGATION_REQUIRES_NEW)) {
		throw new IllegalTransactionStateException("Neo4jTransactionManager only supports 'required' or 'requires new' propagation.");
	}

	TransactionConfig.Builder builder = TransactionConfig.builder();
	if (definition.getTimeout() > 0) {
		builder = builder.withTimeout(Duration.ofSeconds(definition.getTimeout()));
	}

	return builder.build();
}
 
Example 3
Source File: OpenJpaDialect.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Override
public Object beginTransaction(EntityManager entityManager, TransactionDefinition definition)
		throws PersistenceException, SQLException, TransactionException {

	OpenJPAEntityManager openJpaEntityManager = getOpenJPAEntityManager(entityManager);

	if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) {
		// Pass custom isolation level on to OpenJPA's JDBCFetchPlan configuration
		FetchPlan fetchPlan = openJpaEntityManager.getFetchPlan();
		if (fetchPlan instanceof JDBCFetchPlan) {
			IsolationLevel isolation = IsolationLevel.fromConnectionConstant(definition.getIsolationLevel());
			((JDBCFetchPlan) fetchPlan).setIsolation(isolation);
		}
	}

	entityManager.getTransaction().begin();

	if (!definition.isReadOnly()) {
		// Like with EclipseLink, make sure to start the logic transaction early so that other
		// participants using the connection (such as JdbcTemplate) run in a transaction.
		openJpaEntityManager.beginStore();
	}

	// Custom implementation for OpenJPA savepoint handling
	return new OpenJpaTransactionData(openJpaEntityManager);
}
 
Example 4
Source File: EclipseLinkJpaDialect.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Override
@Nullable
public Object beginTransaction(EntityManager entityManager, TransactionDefinition definition)
		throws PersistenceException, SQLException, TransactionException {

	if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) {
		// Pass custom isolation level on to EclipseLink's DatabaseLogin configuration
		// (since Spring 4.1.2)
		UnitOfWork uow = entityManager.unwrap(UnitOfWork.class);
		uow.getLogin().setTransactionIsolation(definition.getIsolationLevel());
	}

	entityManager.getTransaction().begin();

	if (!definition.isReadOnly() && !this.lazyDatabaseTransaction) {
		// Begin an early transaction to force EclipseLink to get a JDBC Connection
		// so that Spring can manage transactions with JDBC as well as EclipseLink.
		entityManager.unwrap(UnitOfWork.class).beginEarlyTransaction();
	}

	return null;
}
 
Example 5
Source File: EclipseLinkJpaDialect.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Override
public Object beginTransaction(EntityManager entityManager, TransactionDefinition definition)
		throws PersistenceException, SQLException, TransactionException {

	if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) {
		// Pass custom isolation level on to EclipseLink's DatabaseLogin configuration
		// (since Spring 4.1.2)
		UnitOfWork uow = entityManager.unwrap(UnitOfWork.class);
		uow.getLogin().setTransactionIsolation(definition.getIsolationLevel());
	}

	entityManager.getTransaction().begin();

	if (!definition.isReadOnly() && !this.lazyDatabaseTransaction) {
		// Begin an early transaction to force EclipseLink to get a JDBC Connection
		// so that Spring can manage transactions with JDBC as well as EclipseLink.
		entityManager.unwrap(UnitOfWork.class).beginEarlyTransaction();
	}

	return null;
}
 
Example 6
Source File: OpenJpaDialect.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Object beginTransaction(EntityManager entityManager, TransactionDefinition definition)
		throws PersistenceException, SQLException, TransactionException {

	OpenJPAEntityManager openJpaEntityManager = getOpenJPAEntityManager(entityManager);

	if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) {
		// Pass custom isolation level on to OpenJPA's JDBCFetchPlan configuration
		FetchPlan fetchPlan = openJpaEntityManager.getFetchPlan();
		if (fetchPlan instanceof JDBCFetchPlan) {
			IsolationLevel isolation = IsolationLevel.fromConnectionConstant(definition.getIsolationLevel());
			((JDBCFetchPlan) fetchPlan).setIsolation(isolation);
		}
	}

	entityManager.getTransaction().begin();

	if (!definition.isReadOnly()) {
		// Like with EclipseLink, make sure to start the logic transaction early so that other
		// participants using the connection (such as JdbcTemplate) run in a transaction.
		openJpaEntityManager.beginStore();
	}

	// Custom implementation for OpenJPA savepoint handling
	return new OpenJpaTransactionData(openJpaEntityManager);
}
 
Example 7
Source File: DefaultJpaDialect.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * This implementation invokes the standard JPA {@code Transaction.begin}
 * method. Throws an InvalidIsolationLevelException if a non-default isolation
 * level is set.
 * <p>This implementation does not return any transaction data Object, since there
 * is no state to be kept for a standard JPA transaction. Hence, subclasses do not
 * have to care about the return value ({@code null}) of this implementation
 * and are free to return their own transaction data Object.
 * @see javax.persistence.EntityTransaction#begin
 * @see org.springframework.transaction.InvalidIsolationLevelException
 * @see #cleanupTransaction
 */
@Override
@Nullable
public Object beginTransaction(EntityManager entityManager, TransactionDefinition definition)
		throws PersistenceException, SQLException, TransactionException {

	if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) {
		throw new InvalidIsolationLevelException(getClass().getSimpleName() +
				" does not support custom isolation levels due to limitations in standard JPA. " +
				"Specific arrangements may be implemented in custom JpaDialect variants.");
	}
	entityManager.getTransaction().begin();
	return null;
}
 
Example 8
Source File: DefaultJpaDialect.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * This implementation invokes the standard JPA {@code Transaction.begin}
 * method. Throws an InvalidIsolationLevelException if a non-default isolation
 * level is set.
 * <p>This implementation does not return any transaction data Object, since there
 * is no state to be kept for a standard JPA transaction. Hence, subclasses do not
 * have to care about the return value ({@code null}) of this implementation
 * and are free to return their own transaction data Object.
 * @see javax.persistence.EntityTransaction#begin
 * @see org.springframework.transaction.InvalidIsolationLevelException
 * @see #cleanupTransaction
 */
@Override
public Object beginTransaction(EntityManager entityManager, TransactionDefinition definition)
		throws PersistenceException, SQLException, TransactionException {

	if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) {
		throw new InvalidIsolationLevelException(getClass().getSimpleName() +
				" does not support custom isolation levels due to limitations in standard JPA. " +
				"Specific arrangements may be implemented in custom JpaDialect variants.");
	}
	entityManager.getTransaction().begin();
	return null;
}
 
Example 9
Source File: SpringTransactionManager.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected void doBegin(Object transaction, TransactionDefinition definition) throws TransactionException {
    if (definition.getIsolationLevel() == TransactionDefinition.ISOLATION_READ_UNCOMMITTED)
        throw new InvalidIsolationLevelException("Ignite does not support READ_UNCOMMITTED isolation level.");

    IgniteTransactionObject txObj = (IgniteTransactionObject)transaction;
    Transaction tx = null;

    try {
        if (txObj.getTransactionHolder() == null || txObj.getTransactionHolder().isSynchronizedWithTransaction()) {
            long timeout = ignite.configuration().getTransactionConfiguration().getDefaultTxTimeout();

            if (definition.getTimeout() > 0)
                timeout = TimeUnit.SECONDS.toMillis(definition.getTimeout());

            Transaction newTx = ignite.transactions().txStart(transactionConcurrency,
                convertToIgniteIsolationLevel(definition.getIsolationLevel()), timeout, 0);

            if (log.isDebugEnabled())
                log.debug("Started Ignite transaction: " + newTx);

            txObj.setTransactionHolder(new IgniteTransactionHolder(newTx), true);
        }

        txObj.getTransactionHolder().setSynchronizedWithTransaction(true);
        txObj.getTransactionHolder().setTransactionActive(true);

        tx = txObj.getTransactionHolder().getTransaction();

        // Bind the session holder to the thread.
        if (txObj.isNewTransactionHolder())
            TransactionSynchronizationManager.bindResource(this.ignite, txObj.getTransactionHolder());
    }
    catch (Exception ex) {
        if (tx != null)
            tx.close();

        throw new CannotCreateTransactionException("Could not create Ignite transaction", ex);
    }
}
 
Example 10
Source File: DefaultJdoDialect.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Determine the JDO isolation level String to use for the given
 * Spring transaction definition.
 * @param definition the Spring transaction definition
 * @return the corresponding JDO isolation level String, or {@code null}
 * to indicate that no isolation level should be set explicitly
 * @see Transaction#setIsolationLevel(String)
 * @see Constants#TX_SERIALIZABLE
 * @see Constants#TX_REPEATABLE_READ
 * @see Constants#TX_READ_COMMITTED
 * @see Constants#TX_READ_UNCOMMITTED
 */
protected String getJdoIsolationLevel(TransactionDefinition definition) {
	switch (definition.getIsolationLevel()) {
		case TransactionDefinition.ISOLATION_SERIALIZABLE:
			return Constants.TX_SERIALIZABLE;
		case TransactionDefinition.ISOLATION_REPEATABLE_READ:
			return Constants.TX_REPEATABLE_READ;
		case TransactionDefinition.ISOLATION_READ_COMMITTED:
			return Constants.TX_READ_COMMITTED;
		case TransactionDefinition.ISOLATION_READ_UNCOMMITTED:
			return Constants.TX_READ_UNCOMMITTED;
		default:
			return null;
	}
}
 
Example 11
Source File: DefaultJdoDialect.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Determine the JDO isolation level String to use for the given
 * Spring transaction definition.
 * @param definition the Spring transaction definition
 * @return the corresponding JDO isolation level String, or {@code null}
 * to indicate that no isolation level should be set explicitly
 * @see Transaction#setIsolationLevel(String)
 * @see Constants#TX_SERIALIZABLE
 * @see Constants#TX_REPEATABLE_READ
 * @see Constants#TX_READ_COMMITTED
 * @see Constants#TX_READ_UNCOMMITTED
 */
protected String getJdoIsolationLevel(TransactionDefinition definition) {
	switch (definition.getIsolationLevel()) {
		case TransactionDefinition.ISOLATION_SERIALIZABLE:
			return Constants.TX_SERIALIZABLE;
		case TransactionDefinition.ISOLATION_REPEATABLE_READ:
			return Constants.TX_REPEATABLE_READ;
		case TransactionDefinition.ISOLATION_READ_COMMITTED:
			return Constants.TX_READ_COMMITTED;
		case TransactionDefinition.ISOLATION_READ_UNCOMMITTED:
			return Constants.TX_READ_UNCOMMITTED;
		default:
			return null;
	}
}
 
Example 12
Source File: DefaultJpaDialect.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This implementation invokes the standard JPA {@code Transaction.begin}
 * method. Throws an InvalidIsolationLevelException if a non-default isolation
 * level is set.
 * <p>This implementation does not return any transaction data Object, since there
 * is no state to be kept for a standard JPA transaction. Hence, subclasses do not
 * have to care about the return value ({@code null}) of this implementation
 * and are free to return their own transaction data Object.
 * @see javax.persistence.EntityTransaction#begin
 * @see org.springframework.transaction.InvalidIsolationLevelException
 * @see #cleanupTransaction
 */
@Override
public Object beginTransaction(EntityManager entityManager, TransactionDefinition definition)
		throws PersistenceException, SQLException, TransactionException {

	if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) {
		throw new InvalidIsolationLevelException(getClass().getSimpleName() +
				" does not support custom isolation levels due to limitations in standard JPA. " +
				"Specific arrangements may be implemented in custom JpaDialect variants.");
	}
	entityManager.getTransaction().begin();
	return null;
}
 
Example 13
Source File: DefaultJpaDialect.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * This implementation invokes the standard JPA {@code Transaction.begin}
 * method. Throws an InvalidIsolationLevelException if a non-default isolation
 * level is set.
 * <p>This implementation does not return any transaction data Object, since there
 * is no state to be kept for a standard JPA transaction. Hence, subclasses do not
 * have to care about the return value ({@code null}) of this implementation
 * and are free to return their own transaction data Object.
 * @see javax.persistence.EntityTransaction#begin
 * @see org.springframework.transaction.InvalidIsolationLevelException
 * @see #cleanupTransaction
 */
@Override
@Nullable
public Object beginTransaction(EntityManager entityManager, TransactionDefinition definition)
		throws PersistenceException, SQLException, TransactionException {

	if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) {
		throw new InvalidIsolationLevelException(getClass().getSimpleName() +
				" does not support custom isolation levels due to limitations in standard JPA. " +
				"Specific arrangements may be implemented in custom JpaDialect variants.");
	}
	entityManager.getTransaction().begin();
	return null;
}
 
Example 14
Source File: DataSourceUtils.java    From java-technology-stack with MIT License 4 votes vote down vote up
/**
 * Prepare the given Connection with the given transaction semantics.
 * @param con the Connection to prepare
 * @param definition the transaction definition to apply
 * @return the previous isolation level, if any
 * @throws SQLException if thrown by JDBC methods
 * @see #resetConnectionAfterTransaction
 */
@Nullable
public static Integer prepareConnectionForTransaction(Connection con, @Nullable TransactionDefinition definition)
		throws SQLException {

	Assert.notNull(con, "No Connection specified");

	// Set read-only flag.
	if (definition != null && definition.isReadOnly()) {
		try {
			if (logger.isDebugEnabled()) {
				logger.debug("Setting JDBC Connection [" + con + "] read-only");
			}
			con.setReadOnly(true);
		}
		catch (SQLException | RuntimeException ex) {
			Throwable exToCheck = ex;
			while (exToCheck != null) {
				if (exToCheck.getClass().getSimpleName().contains("Timeout")) {
					// Assume it's a connection timeout that would otherwise get lost: e.g. from JDBC 4.0
					throw ex;
				}
				exToCheck = exToCheck.getCause();
			}
			// "read-only not supported" SQLException -> ignore, it's just a hint anyway
			logger.debug("Could not set JDBC Connection read-only", ex);
		}
	}

	// Apply specific isolation level, if any.
	Integer previousIsolationLevel = null;
	if (definition != null && definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) {
		if (logger.isDebugEnabled()) {
			logger.debug("Changing isolation level of JDBC Connection [" + con + "] to " +
					definition.getIsolationLevel());
		}
		int currentIsolation = con.getTransactionIsolation();
		if (currentIsolation != definition.getIsolationLevel()) {
			previousIsolationLevel = currentIsolation;
			con.setTransactionIsolation(definition.getIsolationLevel());
		}
	}

	return previousIsolationLevel;
}
 
Example 15
Source File: HibernateJpaDialect.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public Object beginTransaction(EntityManager entityManager, TransactionDefinition definition)
		throws PersistenceException, SQLException, TransactionException {

	Session session = getSession(entityManager);

	if (definition.getTimeout() != TransactionDefinition.TIMEOUT_DEFAULT) {
		session.getTransaction().setTimeout(definition.getTimeout());
	}

	boolean isolationLevelNeeded = (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT);
	Integer previousIsolationLevel = null;
	Connection preparedCon = null;

	if (isolationLevelNeeded || definition.isReadOnly()) {
		if (this.prepareConnection) {
			preparedCon = HibernateConnectionHandle.doGetConnection(session);
			previousIsolationLevel = DataSourceUtils.prepareConnectionForTransaction(preparedCon, definition);
		}
		else if (isolationLevelNeeded) {
			throw new InvalidIsolationLevelException(getClass().getSimpleName() +
					" does not support custom isolation levels since the 'prepareConnection' flag is off.");
		}
	}

	// Standard JPA transaction begin call for full JPA context setup...
	entityManager.getTransaction().begin();

	// Adapt flush mode and store previous isolation level, if any.
	FlushMode previousFlushMode = prepareFlushMode(session, definition.isReadOnly());
	if (definition instanceof ResourceTransactionDefinition &&
			((ResourceTransactionDefinition) definition).isLocalResource()) {
		// As of 5.1, we explicitly optimize for a transaction-local EntityManager,
		// aligned with native HibernateTransactionManager behavior.
		previousFlushMode = null;
		if (definition.isReadOnly()) {
			session.setDefaultReadOnly(true);
		}
	}
	return new SessionTransactionData(session, previousFlushMode, preparedCon, previousIsolationLevel);
}
 
Example 16
Source File: DataSourceUtils.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * Prepare the given Connection with the given transaction semantics.
 * @param con the Connection to prepare
 * @param definition the transaction definition to apply
 * @return the previous isolation level, if any
 * @throws SQLException if thrown by JDBC methods
 * @see #resetConnectionAfterTransaction
 */
@Nullable
public static Integer prepareConnectionForTransaction(Connection con, @Nullable TransactionDefinition definition)
		throws SQLException {

	Assert.notNull(con, "No Connection specified");

	// Set read-only flag.
	if (definition != null && definition.isReadOnly()) {
		try {
			if (logger.isDebugEnabled()) {
				logger.debug("Setting JDBC Connection [" + con + "] read-only");
			}
			con.setReadOnly(true);
		}
		catch (SQLException | RuntimeException ex) {
			Throwable exToCheck = ex;
			while (exToCheck != null) {
				if (exToCheck.getClass().getSimpleName().contains("Timeout")) {
					// Assume it's a connection timeout that would otherwise get lost: e.g. from JDBC 4.0
					throw ex;
				}
				exToCheck = exToCheck.getCause();
			}
			// "read-only not supported" SQLException -> ignore, it's just a hint anyway
			logger.debug("Could not set JDBC Connection read-only", ex);
		}
	}

	// Apply specific isolation level, if any.
	Integer previousIsolationLevel = null;
	if (definition != null && definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) {
		if (logger.isDebugEnabled()) {
			logger.debug("Changing isolation level of JDBC Connection [" + con + "] to " +
					definition.getIsolationLevel());
		}
		int currentIsolation = con.getTransactionIsolation();
		if (currentIsolation != definition.getIsolationLevel()) {
			previousIsolationLevel = currentIsolation;
			con.setTransactionIsolation(definition.getIsolationLevel());
		}
	}

	return previousIsolationLevel;
}
 
Example 17
Source File: HibernateJpaDialect.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public Object beginTransaction(EntityManager entityManager, TransactionDefinition definition)
		throws PersistenceException, SQLException, TransactionException {

	Session session = getSession(entityManager);

	if (definition.getTimeout() != TransactionDefinition.TIMEOUT_DEFAULT) {
		session.getTransaction().setTimeout(definition.getTimeout());
	}

	boolean isolationLevelNeeded = (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT);
	Integer previousIsolationLevel = null;
	Connection preparedCon = null;

	if (isolationLevelNeeded || definition.isReadOnly()) {
		if (this.prepareConnection) {
			preparedCon = HibernateConnectionHandle.doGetConnection(session);
			previousIsolationLevel = DataSourceUtils.prepareConnectionForTransaction(preparedCon, definition);
		}
		else if (isolationLevelNeeded) {
			throw new InvalidIsolationLevelException(getClass().getSimpleName() +
					" does not support custom isolation levels since the 'prepareConnection' flag is off.");
		}
	}

	// Standard JPA transaction begin call for full JPA context setup...
	entityManager.getTransaction().begin();

	// Adapt flush mode and store previous isolation level, if any.
	FlushMode previousFlushMode = prepareFlushMode(session, definition.isReadOnly());
	if (definition instanceof ResourceTransactionDefinition &&
			((ResourceTransactionDefinition) definition).isLocalResource()) {
		// As of 5.1, we explicitly optimize for a transaction-local EntityManager,
		// aligned with native HibernateTransactionManager behavior.
		previousFlushMode = null;
		if (definition.isReadOnly()) {
			session.setDefaultReadOnly(true);
		}
	}
	return new SessionTransactionData(session, previousFlushMode, preparedCon, previousIsolationLevel);
}
 
Example 18
Source File: DefaultTransactionDefinition.java    From spring4-understanding with Apache License 2.0 3 votes vote down vote up
/**
 * Copy constructor. Definition can be modified through bean property setters.
 * @see #setPropagationBehavior
 * @see #setIsolationLevel
 * @see #setTimeout
 * @see #setReadOnly
 * @see #setName
 */
public DefaultTransactionDefinition(TransactionDefinition other) {
	this.propagationBehavior = other.getPropagationBehavior();
	this.isolationLevel = other.getIsolationLevel();
	this.timeout = other.getTimeout();
	this.readOnly = other.isReadOnly();
	this.name = other.getName();
}
 
Example 19
Source File: DefaultTransactionDefinition.java    From java-technology-stack with MIT License 3 votes vote down vote up
/**
 * Copy constructor. Definition can be modified through bean property setters.
 * @see #setPropagationBehavior
 * @see #setIsolationLevel
 * @see #setTimeout
 * @see #setReadOnly
 * @see #setName
 */
public DefaultTransactionDefinition(TransactionDefinition other) {
	this.propagationBehavior = other.getPropagationBehavior();
	this.isolationLevel = other.getIsolationLevel();
	this.timeout = other.getTimeout();
	this.readOnly = other.isReadOnly();
	this.name = other.getName();
}
 
Example 20
Source File: DefaultTransactionDefinition.java    From spring-analysis-note with MIT License 3 votes vote down vote up
/**
 * Copy constructor. Definition can be modified through bean property setters.
 * @see #setPropagationBehavior
 * @see #setIsolationLevel
 * @see #setTimeout
 * @see #setReadOnly
 * @see #setName
 */
public DefaultTransactionDefinition(TransactionDefinition other) {
	this.propagationBehavior = other.getPropagationBehavior();
	this.isolationLevel = other.getIsolationLevel();
	this.timeout = other.getTimeout();
	this.readOnly = other.isReadOnly();
	this.name = other.getName();
}