Enum Class SqlConfig.TransactionMode
- 所有已实现的接口:
Serializable,Comparable<SqlConfig.TransactionMode>,Constable
- 封闭类:
- SqlConfig
Enumeration of modes that dictate whether SQL scripts should be
executed within a transaction and what the transaction propagation behavior
should be.
-
嵌套类概要
从类继承的嵌套类/接口 java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
枚举常量概要
枚举常量枚举常量说明Indicates that the default transaction mode should be used.Indicates that the transaction mode to use when executing SQL scripts should be inferred using the rules listed below.Indicates that SQL scripts should always be executed in a new, isolated transaction that will be immediately committed. -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static SqlConfig.TransactionModeReturns the enum constant of this class with the specified name.static SqlConfig.TransactionMode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
枚举常量详细资料
-
DEFAULT
Indicates that the default transaction mode should be used.The meaning of default depends on the context in which
@SqlConfigis declared:- If
@SqlConfigis declared only locally, the default transaction mode isINFERRED. - If
@SqlConfigis declared globally, the default transaction mode isINFERRED. - If
@SqlConfigis declared globally and locally, the default transaction mode for the local declaration is inherited from the global declaration.
- If
-
INFERRED
Indicates that the transaction mode to use when executing SQL scripts should be inferred using the rules listed below. In the context of these rules, the term "available" means that the bean for the data source or transaction manager is either explicitly specified via a corresponding annotation attribute in@SqlConfigor discoverable via conventions. SeeTestContextTransactionUtilsfor details on the conventions used to discover such beans in theApplicationContext.Inference Rules
- If neither a transaction manager nor a data source is available, an exception will be thrown.
- If a transaction manager is not available but a data source is available, SQL scripts will be executed directly against the data source without a transaction.
- If a transaction manager is available:
- If a data source is not available, an attempt will be made
to retrieve it from the transaction manager by using reflection
to invoke a public method named
getDataSource()on the transaction manager. If the attempt fails, an exception will be thrown. - Using the resolved transaction manager and data source, SQL
scripts will be executed within an existing transaction if
present; otherwise, scripts will be executed in a new transaction
that will be immediately committed. An existing
transaction will typically be managed by the
TransactionalTestExecutionListener.
- If a data source is not available, an attempt will be made
to retrieve it from the transaction manager by using reflection
to invoke a public method named
-
ISOLATED
Indicates that SQL scripts should always be executed in a new, isolated transaction that will be immediately committed.In contrast to
INFERRED, this mode requires the presence of a transaction manager and a data source.
-
-
构造器详细资料
-
TransactionMode
private TransactionMode()
-
-
方法详细资料
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- 返回:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- 参数:
name- 要返回的枚举常量的名称。- 返回:
- 返回带有指定名称的枚举常量
- 抛出:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- 如果参数为空值
-