當前位置: 首頁>>代碼示例>>Java>>正文


Java TransactionDefinition.getPropagationBehavior方法代碼示例

本文整理匯總了Java中org.springframework.transaction.TransactionDefinition.getPropagationBehavior方法的典型用法代碼示例。如果您正苦於以下問題:Java TransactionDefinition.getPropagationBehavior方法的具體用法?Java TransactionDefinition.getPropagationBehavior怎麽用?Java TransactionDefinition.getPropagationBehavior使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.transaction.TransactionDefinition的用法示例。


在下文中一共展示了TransactionDefinition.getPropagationBehavior方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getTransaction

import org.springframework.transaction.TransactionDefinition; //導入方法依賴的package包/類
@Override
public TransactionStatus getTransaction(final TransactionDefinition definition) {
    if (!enabled) {
        return null;
    }
    final Deque<PersistenceUnitContext> deque = curContext.get();
    if (definition.getPropagationBehavior() == TransactionDefinition.PROPAGATION_NEVER && deque.size() == 0) {
        /*
         * don't delegate if no transaction is desired and currently none exists; this resolves some bugs with
         * updates not being recognized properly in queries
         */
        return NO_TRANSACTION;
    } else {
        //since it is <classname>.<methodname> we can use string operations here
        final PersistenceUnitContext context;
        if (definition.getName() != null) {
            final String className = Strings.substringBeforeLast(definition.getName(), ".");
            context = className_persistenceUnitContext.get(className);
        } else {
            context = PersistenceProperties
                    .getPersistenceUnitContext(PersistenceProperties.DEFAULT_PERSISTENCE_UNIT_NAME);
        }
        deque.addLast(context);
        return context.getTransactionManager().getTransaction(definition);
    }
}
 
開發者ID:subes,項目名稱:invesdwin-context-persistence,代碼行數:27,代碼來源:ContextDelegatingTransactionManager.java

示例2: DefaultTransactionDefinition

import org.springframework.transaction.TransactionDefinition; //導入方法依賴的package包/類
/**
 * 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();
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:16,代碼來源:DefaultTransactionDefinition.java


注:本文中的org.springframework.transaction.TransactionDefinition.getPropagationBehavior方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。