open class DefaultTransactionDefinition : TransactionDefinition, Serializable
Default implementation of the TransactionDefinition interface, offering bean-style configuration and sensible default values (PROPAGATION_REQUIRED, ISOLATION_DEFAULT, TIMEOUT_DEFAULT, readOnly=false).
Base class for both TransactionTemplate and org.springframework.transaction.interceptor.DefaultTransactionAttribute.
Author
Juergen Hoeller
Since
08.05.2003
DefaultTransactionDefinition()
Create a new DefaultTransactionDefinition, with default settings. Can be modified through bean property setters. DefaultTransactionDefinition(other: TransactionDefinition)
Copy constructor. Definition can be modified through bean property setters. DefaultTransactionDefinition(propagationBehavior: Int)
Create a new DefaultTransactionDefinition with the given propagation behavior. Can be modified through bean property setters. |
static val PREFIX_ISOLATION: String
Prefix for the isolation constants defined in TransactionDefinition |
|
static val PREFIX_PROPAGATION: String
Prefix for the propagation constants defined in TransactionDefinition |
|
static val PREFIX_TIMEOUT: String
Prefix for transaction timeout values in description strings |
|
static val READ_ONLY_MARKER: String
Marker for read-only transactions in description strings |
open fun equals(other: Any?): Boolean
This implementation compares the |
|
fun getIsolationLevel(): Int |
|
fun getName(): String |
|
fun getPropagationBehavior(): Int |
|
fun getTimeout(): Int |
|
open fun hashCode(): Int
This implementation returns |
|
fun isReadOnly(): Boolean |
|
fun setIsolationLevel(isolationLevel: Int): Unit
Set the isolation level. Must be one of the isolation constants in the TransactionDefinition interface. Default is ISOLATION_DEFAULT. |
|
fun setIsolationLevelName(constantName: String): Unit
Set the isolation level by the name of the corresponding constant in TransactionDefinition, e.g. "ISOLATION_DEFAULT". |
|
fun setName(name: String): Unit
Set the name of this transaction. Default is none. This will be used as transaction name to be shown in a transaction monitor, if applicable (for example, WebLogic's). |
|
fun setPropagationBehavior(propagationBehavior: Int): Unit
Set the propagation behavior. Must be one of the propagation constants in the TransactionDefinition interface. Default is PROPAGATION_REQUIRED. |
|
fun setPropagationBehaviorName(constantName: String): Unit
Set the propagation behavior by the name of the corresponding constant in TransactionDefinition, e.g. "PROPAGATION_REQUIRED". |
|
fun setReadOnly(readOnly: Boolean): Unit
Set whether to optimize as read-only transaction. Default is "false". |
|
fun setTimeout(timeout: Int): Unit
Set the timeout to apply, as number of seconds. Default is TIMEOUT_DEFAULT (-1). |
|
open fun toString(): String
Return an identifying description for this transaction definition. The format matches the one used by org.springframework.transaction.interceptor.TransactionAttributeEditor, to be able to feed Has to be overridden in subclasses for correct |
open class TransactionTemplate : DefaultTransactionDefinition, TransactionOperations, InitializingBean
Template class that simplifies programmatic transaction demarcation and transaction exception handling. The central method is Typical usage: Allows for writing low-level data access objects that use resources such as JDBC DataSources but are not transaction-aware themselves. Instead, they can implicitly participate in transactions handled by higher-level application services utilizing this class, making calls to the low-level services via an inner-class callback object. Can be used within a service implementation via direct instantiation with a transaction manager reference, or get prepared in an application context and passed to services as bean reference. Note: The transaction manager should always be configured as bean in the application context: in the first case given to the service directly, in the second case given to the prepared template. Supports setting the propagation behavior and the isolation level by name, for convenient configuration in context definitions. |