public class DefaultTransactionDefine extends Object implements TransactionDefine
TransactionDefine.MODE| 限定符和类型 | 字段和说明 |
|---|---|
static String |
PREFIX_ISOLATION
Prefix for the isolation constants defined in TransactionDefinition.
|
static String |
PREFIX_PROPAGATION
Prefix for the propagation constants defined in TransactionDefinition.
|
static String |
PREFIX_TIMEOUT
Prefix for transaction timeout values in description strings.
|
static String |
READ_ONLY_MARKER
Marker for read-only transactions in description strings.
|
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| 构造器和说明 |
|---|
DefaultTransactionDefine()
Create a new DefaultTransactionDefinition, with default settings.
|
DefaultTransactionDefine(int propagationBehavior)
Create a new DefaultTransactionDefinition with the given
propagation behavior.
|
DefaultTransactionDefine(TransactionDefine other)
Copy constructor.
|
| 限定符和类型 | 方法和说明 |
|---|---|
int |
getIsolationLevel()
Return the isolation level.
|
TransactionDefine.MODE |
getMode() |
String |
getName()
Return the name of this transaction.
|
int |
getPropagationBehavior()
Return the propagation behavior.
|
String |
getPropagationBehaviorName() |
int |
getTimeout()
Return the transaction timeout.
|
boolean |
isReadOnly()
Return whether to optimize as a read-only transaction.
|
void |
setMode(TransactionDefine.MODE mode) |
void |
setName(String name)
Set the name of this transaction.
|
void |
setReadOnly(boolean readOnly)
Set whether to optimize as read-only transaction.
|
void |
setTimeout(int timeout)
Set the timeout to apply, as number of seconds.
|
public static final String PREFIX_PROPAGATION
public static final String PREFIX_ISOLATION
public static final String PREFIX_TIMEOUT
public DefaultTransactionDefine()
public DefaultTransactionDefine(TransactionDefine other)
public DefaultTransactionDefine(int propagationBehavior)
propagationBehavior - one of the propagation constants in the
TransactionDefinition interfacepublic final int getPropagationBehavior()
TransactionDefineMust return one of the PROPAGATION_XXX constants
The default is TransactionDefine.PROPAGATION_REQUIRED.
getPropagationBehavior 在接口中 TransactionDefineTransactionDefine.PROPAGATION_REQUIREDpublic String getPropagationBehaviorName()
getPropagationBehaviorName 在接口中 TransactionDefinepublic final int getIsolationLevel()
TransactionDefineMust return one of the ISOLATION_XXX constants defined on
Exclusively designed for use with TransactionDefine.PROPAGATION_REQUIRED or
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.
The default is TransactionDefine.ISOLATION_DEFAULT. Note that a transaction manager
that does not support custom isolation levels will throw an exception when
given any other level than TransactionDefine.ISOLATION_DEFAULT.
getIsolationLevel 在接口中 TransactionDefinepublic void setTimeout(int timeout)
Exclusively designed for use with TransactionDefine.PROPAGATION_REQUIRED or
TransactionDefine.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 TransactionDefine.TIMEOUT_DEFAULT.
setTimeout 在接口中 TransactionDefineTransactionDefine.TIMEOUT_DEFAULTpublic final int getTimeout()
TransactionDefineMust return a number of seconds, or TransactionDefine.TIMEOUT_DEFAULT.
Exclusively designed for use with TransactionDefine.PROPAGATION_REQUIRED or
TransactionDefine.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 TransactionDefine.TIMEOUT_DEFAULT.
The default is TransactionDefine.TIMEOUT_DEFAULT.
getTimeout 在接口中 TransactionDefinepublic void setReadOnly(boolean readOnly)
The read-only flag applies to any transaction context, whether backed
by an actual resource transaction (TransactionDefine.PROPAGATION_REQUIRED/
TransactionDefine.PROPAGATION_REQUIRES_NEW) or operating non-transactionally at
the resource level (TransactionDefine.PROPAGATION_SUPPORTS). In the latter case,
the flag will only apply to managed resources within the application,
such as a Hibernate Session.
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.
setReadOnly 在接口中 TransactionDefinepublic final boolean isReadOnly()
TransactionDefineThe read-only flag applies to any transaction context, whether backed
by an actual resource transaction (TransactionDefine.PROPAGATION_REQUIRED/
TransactionDefine.PROPAGATION_REQUIRES_NEW) or operating non-transactionally at
the resource level (TransactionDefine.PROPAGATION_SUPPORTS). In the latter case,
the flag will only apply to managed resources within the application,
such as a Hibernate Session.
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 在接口中 TransactionDefinetrue if the transaction is to be optimized as read-only
(false by default)public void setName(String name)
This will be used as transaction name to be shown in a transaction monitor, if applicable (for example, WebLogic's).
setName 在接口中 TransactionDefinepublic String getName()
TransactionDefinenull.
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 在接口中 TransactionDefinenull by default}public TransactionDefine.MODE getMode()
getMode 在接口中 TransactionDefinepublic void setMode(TransactionDefine.MODE mode)
setMode 在接口中 TransactionDefineCopyright © 2025. All rights reserved.