类 DelegatingTransactionDefinition
- java.lang.Object
- org.springframework.transaction.support.DelegatingTransactionDefinition
- 所有已实现的接口:
Serializable
,TransactionDefinition
public abstract class DelegatingTransactionDefinition extends Object implements TransactionDefinition, Serializable
TransactionDefinition
implementation that delegates all calls to a given targetTransactionDefinition
instance. Abstract because it is meant to be subclassed, with subclasses overriding specific methods that are not supposed to simply delegate to the target instance.- 从以下版本开始:
- 3.0
- 作者:
- Juergen Hoeller
- 另请参阅:
- 序列化表格
字段概要
从接口继承的字段 org.springframework.transaction.TransactionDefinition
ISOLATION_DEFAULT, ISOLATION_READ_COMMITTED, ISOLATION_READ_UNCOMMITTED, ISOLATION_REPEATABLE_READ, ISOLATION_SERIALIZABLE, PROPAGATION_MANDATORY, PROPAGATION_NESTED, PROPAGATION_NEVER, PROPAGATION_NOT_SUPPORTED, PROPAGATION_REQUIRED, PROPAGATION_REQUIRES_NEW, PROPAGATION_SUPPORTS, TIMEOUT_DEFAULT
构造器概要
构造器 构造器 说明 DelegatingTransactionDefinition(TransactionDefinition targetDefinition)
Create a DelegatingTransactionAttribute for the given target attribute.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 boolean
equals(Object obj)
int
getIsolationLevel()
Return the isolation level.String
getName()
Return the name of this transaction.int
getPropagationBehavior()
Return the propagation behavior.int
getTimeout()
Return the transaction timeout.int
hashCode()
boolean
isReadOnly()
Return whether to optimize as a read-only transaction.String
toString()
构造器详细资料
DelegatingTransactionDefinition
public DelegatingTransactionDefinition(TransactionDefinition targetDefinition)
Create a DelegatingTransactionAttribute for the given target attribute.- 参数:
targetDefinition
- the target TransactionAttribute to delegate to
方法详细资料
getPropagationBehavior
public int getPropagationBehavior()
从接口复制的说明:TransactionDefinition
Return the propagation behavior.Must return one of the
PROPAGATION_XXX
constants defined onthis interface
.- 指定者:
getPropagationBehavior
在接口中TransactionDefinition
- 返回:
- the propagation behavior
- 另请参阅:
TransactionDefinition.PROPAGATION_REQUIRED
,TransactionSynchronizationManager.isActualTransactionActive()
getIsolationLevel
public int getIsolationLevel()
从接口复制的说明:TransactionDefinition
Return the isolation level.Must return one of the
ISOLATION_XXX
constants defined onthis interface
. Those constants are designed to match the values of the same constants onConnection
.Exclusively designed for use with
TransactionDefinition.PROPAGATION_REQUIRED
orTransactionDefinition.PROPAGATION_REQUIRES_NEW
since it only applies to newly started transactions. Consider switching the "validateExistingTransactions" flag to "true" on your transaction manager if you'd like isolation level declarations to get rejected when participating in an existing transaction with a different isolation level.Note that a transaction manager that does not support custom isolation levels will throw an exception when given any other level than
TransactionDefinition.ISOLATION_DEFAULT
.- 指定者:
getIsolationLevel
在接口中TransactionDefinition
- 返回:
- the isolation level
- 另请参阅:
TransactionDefinition.ISOLATION_DEFAULT
,AbstractPlatformTransactionManager.setValidateExistingTransaction(boolean)
getTimeout
public int getTimeout()
从接口复制的说明:TransactionDefinition
Return the transaction timeout.Must return a number of seconds, or
TransactionDefinition.TIMEOUT_DEFAULT
.Exclusively designed for use with
TransactionDefinition.PROPAGATION_REQUIRED
orTransactionDefinition.PROPAGATION_REQUIRES_NEW
since it only applies to newly started transactions.Note that a transaction manager that does not support timeouts will throw an exception when given any other timeout than
TransactionDefinition.TIMEOUT_DEFAULT
.- 指定者:
getTimeout
在接口中TransactionDefinition
- 返回:
- the transaction timeout
isReadOnly
public boolean isReadOnly()
从接口复制的说明:TransactionDefinition
Return whether to optimize as a read-only transaction.The read-only flag applies to any transaction context, whether backed by an actual resource transaction (
TransactionDefinition.PROPAGATION_REQUIRED
/TransactionDefinition.PROPAGATION_REQUIRES_NEW
) or operating non-transactionally at the resource level (TransactionDefinition.PROPAGATION_SUPPORTS
). In the latter case, the flag will only apply to managed resources within the application, such as a HibernateSession
.This just serves as a hint for the actual transaction subsystem; it will not necessarily cause failure of write access attempts. A transaction manager which cannot interpret the read-only hint will not throw an exception when asked for a read-only transaction.
- 指定者:
isReadOnly
在接口中TransactionDefinition
- 返回:
true
if the transaction is to be optimized as read-only- 另请参阅:
TransactionSynchronization.beforeCommit(boolean)
,TransactionSynchronizationManager.isCurrentTransactionReadOnly()
getName
public String getName()
从接口复制的说明:TransactionDefinition
Return the name of this transaction. Can benull
.This will be used as the transaction name to be shown in a transaction monitor, if applicable (for example, WebLogic's).
In case of Spring's declarative transactions, the exposed name will be the
fully-qualified class name + "." + method name
(by default).- 指定者:
getName
在接口中TransactionDefinition
- 返回:
- the name of this transaction
- 另请参阅:
TransactionAspectSupport
,TransactionSynchronizationManager.getCurrentTransactionName()