当前位置: 首页>>代码示例>>Java>>正文


Java DefaultTransactionStatus.isNewTransaction方法代码示例

本文整理汇总了Java中org.springframework.transaction.support.DefaultTransactionStatus.isNewTransaction方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultTransactionStatus.isNewTransaction方法的具体用法?Java DefaultTransactionStatus.isNewTransaction怎么用?Java DefaultTransactionStatus.isNewTransaction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.transaction.support.DefaultTransactionStatus的用法示例。


在下文中一共展示了DefaultTransactionStatus.isNewTransaction方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareForCommit

import org.springframework.transaction.support.DefaultTransactionStatus; //导入方法依赖的package包/类
@Override
protected void prepareForCommit(DefaultTransactionStatus status) {
	if (this.earlyFlushBeforeCommit && status.isNewTransaction()) {
		HibernateTransactionObject txObject = (HibernateTransactionObject) status.getTransaction();
		Session session = txObject.getSessionHolder().getSession();
		if (!session.getFlushMode().lessThan(FlushMode.COMMIT)) {
			logger.debug("Performing an early flush for Hibernate transaction");
			try {
				session.flush();
			}
			catch (HibernateException ex) {
				throw convertHibernateAccessException(ex);
			}
			finally {
				session.setFlushMode(FlushMode.MANUAL);
			}
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:HibernateTransactionManager.java

示例2: doRollback

import org.springframework.transaction.support.DefaultTransactionStatus; //导入方法依赖的package包/类
@Override
protected void doRollback(DefaultTransactionStatus status)
{
	MolgenisTransaction transaction = (MolgenisTransaction) status.getTransaction();
	if (LOG.isDebugEnabled())
	{
		LOG.debug("Rollback transaction [{}]", transaction.getId());
	}

	DefaultTransactionStatus jpaTransactionStatus = new DefaultTransactionStatus(
			transaction.getDataSourceTransaction(), status.isNewTransaction(), status.isNewSynchronization(),
			status.isReadOnly(), status.isDebug(), status.getSuspendedResources());

	if (!status.isReadOnly())
	{
		transactionListeners.forEach(j -> j.rollbackTransaction(transaction.getId()));
	}

	super.doRollback(jpaTransactionStatus);
}
 
开发者ID:molgenis,项目名称:molgenis,代码行数:21,代码来源:PostgreSqlTransactionManager.java

示例3: prepareSynchronization

import org.springframework.transaction.support.DefaultTransactionStatus; //导入方法依赖的package包/类
@Override
protected void prepareSynchronization(DefaultTransactionStatus status, TransactionDefinition definition) {
    super.prepareSynchronization(status, definition);
    if (status.isNewTransaction()) {
        TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapterData());
        TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapterTask());
    }
}
 
开发者ID:eclecticlogic,项目名称:pedal-tx,代码行数:9,代码来源:JPATransactionWrapper.java

示例4: doCommit

import org.springframework.transaction.support.DefaultTransactionStatus; //导入方法依赖的package包/类
@Override
protected void doCommit(DefaultTransactionStatus status)
{
	MolgenisTransaction transaction = (MolgenisTransaction) status.getTransaction();
	if (LOG.isDebugEnabled())
	{
		LOG.debug("Commit transaction [{}]", transaction.getId());
	}

	DefaultTransactionStatus jpaTransactionStatus = new DefaultTransactionStatus(
			transaction.getDataSourceTransaction(), status.isNewTransaction(), status.isNewSynchronization(),
			status.isReadOnly(), status.isDebug(), status.getSuspendedResources());

	if (!status.isReadOnly())
	{
		transactionListeners.forEach(j -> j.commitTransaction(transaction.getId()));
	}

	try
	{
		super.doCommit(jpaTransactionStatus);
	}
	catch (TransactionException e)
	{
		throw translateTransactionException(e);
	}

	if (!status.isReadOnly())
	{
		transactionListeners.forEach(j -> j.afterCommitTransaction(transaction.getId()));
	}
}
 
开发者ID:molgenis,项目名称:molgenis,代码行数:33,代码来源:PostgreSqlTransactionManager.java

示例5: doSetRollbackOnly

import org.springframework.transaction.support.DefaultTransactionStatus; //导入方法依赖的package包/类
@Override
protected void doSetRollbackOnly(DefaultTransactionStatus status)
{
	MolgenisTransaction transaction = (MolgenisTransaction) status.getTransaction();

	DefaultTransactionStatus jpaTransactionStatus = new DefaultTransactionStatus(
			transaction.getDataSourceTransaction(), status.isNewTransaction(), status.isNewSynchronization(),
			status.isReadOnly(), status.isDebug(), status.getSuspendedResources());

	super.doSetRollbackOnly(jpaTransactionStatus);
}
 
开发者ID:molgenis,项目名称:molgenis,代码行数:12,代码来源:PostgreSqlTransactionManager.java

示例6: doCommit

import org.springframework.transaction.support.DefaultTransactionStatus; //导入方法依赖的package包/类
protected void doCommit(DefaultTransactionStatus status) {

        ContextSourceAndHibernateTransactionObject actualTransactionObject = (ContextSourceAndHibernateTransactionObject) status
                .getTransaction();

        try {
            super.doCommit(new DefaultTransactionStatus(actualTransactionObject
                    .getHibernateTransactionObject(), status
                    .isNewTransaction(), status.isNewSynchronization(), status
                    .isReadOnly(), status.isDebug(), status
                    .getSuspendedResources()));
        } catch (TransactionException ex) {
            if (isRollbackOnCommitFailure()) {
                logger.debug("Failed to commit db resource, rethrowing", ex);
                // If we are to rollback on commit failure, just rethrow the
                // exception - this will cause a rollback to be performed on
                // both resources.
                throw ex;
            } else {
                logger
                        .warn("Failed to commit and resource is rollbackOnCommit not set -"
                                + " proceeding to commit ldap resource.");
            }
        }
        ldapManagerDelegate.doCommit(new DefaultTransactionStatus(
                actualTransactionObject.getLdapTransactionObject(), status
                        .isNewTransaction(), status.isNewSynchronization(),
                status.isReadOnly(), status.isDebug(), status
                        .getSuspendedResources()));
    }
 
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:31,代码来源:ContextSourceAndHibernateTransactionManager.java

示例7: doRollback

import org.springframework.transaction.support.DefaultTransactionStatus; //导入方法依赖的package包/类
protected void doRollback(DefaultTransactionStatus status) {
    ContextSourceAndHibernateTransactionObject actualTransactionObject = (ContextSourceAndHibernateTransactionObject) status
            .getTransaction();

    super.doRollback(new DefaultTransactionStatus(actualTransactionObject
            .getHibernateTransactionObject(), status.isNewTransaction(),
            status.isNewSynchronization(), status.isReadOnly(), status
                    .isDebug(), status.getSuspendedResources()));
    ldapManagerDelegate.doRollback(new DefaultTransactionStatus(
            actualTransactionObject.getLdapTransactionObject(), status
                    .isNewTransaction(), status.isNewSynchronization(),
            status.isReadOnly(), status.isDebug(), status
                    .getSuspendedResources()));
}
 
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:15,代码来源:ContextSourceAndHibernateTransactionManager.java

示例8: doCommit

import org.springframework.transaction.support.DefaultTransactionStatus; //导入方法依赖的package包/类
protected void doCommit(DefaultTransactionStatus status) {

        ContextSourceAndDataSourceTransactionObject actualTransactionObject = (ContextSourceAndDataSourceTransactionObject) status
                .getTransaction();

        try {
            super.doCommit(new DefaultTransactionStatus(actualTransactionObject
                    .getDataSourceTransactionObject(), status
                    .isNewTransaction(), status.isNewSynchronization(), status
                    .isReadOnly(), status.isDebug(), status
                    .getSuspendedResources()));
        } catch (TransactionException ex) {
            if (isRollbackOnCommitFailure()) {
                logger.debug("Failed to commit db resource, rethrowing", ex);
                // If we are to rollback on commit failure, just rethrow the
                // exception - this will cause a rollback to be performed on
                // both resources.
                throw ex;
            } else {
                logger
                        .warn("Failed to commit and resource is rollbackOnCommit not set -"
                                + " proceeding to commit ldap resource.");
            }
        }
        ldapManagerDelegate.doCommit(new DefaultTransactionStatus(
                actualTransactionObject.getLdapTransactionObject(), status
                        .isNewTransaction(), status.isNewSynchronization(),
                status.isReadOnly(), status.isDebug(), status
                        .getSuspendedResources()));
    }
 
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:31,代码来源:ContextSourceAndDataSourceTransactionManager.java

示例9: doRollback

import org.springframework.transaction.support.DefaultTransactionStatus; //导入方法依赖的package包/类
protected void doRollback(DefaultTransactionStatus status) {
    ContextSourceAndDataSourceTransactionObject actualTransactionObject = (ContextSourceAndDataSourceTransactionObject) status
            .getTransaction();

    super.doRollback(new DefaultTransactionStatus(actualTransactionObject
            .getDataSourceTransactionObject(), status.isNewTransaction(),
            status.isNewSynchronization(), status.isReadOnly(), status
                    .isDebug(), status.getSuspendedResources()));
    ldapManagerDelegate.doRollback(new DefaultTransactionStatus(
            actualTransactionObject.getLdapTransactionObject(), status
                    .isNewTransaction(), status.isNewSynchronization(),
            status.isReadOnly(), status.isDebug(), status
                    .getSuspendedResources()));
}
 
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:15,代码来源:ContextSourceAndDataSourceTransactionManager.java


注:本文中的org.springframework.transaction.support.DefaultTransactionStatus.isNewTransaction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。