|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TransactionDefinition
Interface for classes that define transaction properties. Base interface for TransactionAttribute.
Note that isolation level, timeout and read-only settings will not get applied unless a new transaction gets started. As only PROPAGATION_REQUIRED and PROPAGATION_REQUIRES_NEW can actually cause that, it usually doesn't make sense to specify those settings in all other cases. Furthermore, be aware that not all transaction managers will support those advanced features and thus might throw corresponding exceptions when given non-default values.
DefaultTransactionDefinition
,
TransactionAttribute
Field Summary | |
---|---|
static String |
ISOLATION_CONSTANT_PREFIX
|
static int |
ISOLATION_DEFAULT
Use the default isolation level of the underlying datastore. |
static int |
ISOLATION_READ_COMMITTED
|
static int |
ISOLATION_READ_UNCOMMITTED
|
static int |
ISOLATION_REPEATABLE_READ
|
static int |
ISOLATION_SERIALIZABLE
|
static String |
PROPAGATION_CONSTANT_PREFIX
|
static int |
PROPAGATION_MANDATORY
Support a current transaction, throw an exception if none exists. |
static int |
PROPAGATION_NESTED
Execute within a nested transaction if a current transaction exists, behave like PROPAGATION_REQUIRED else. |
static int |
PROPAGATION_NEVER
Execute non-transactionally, throw an exception if a transaction exists. |
static int |
PROPAGATION_NOT_SUPPORTED
Execute non-transactionally, suspend the current transaction if one exists. |
static int |
PROPAGATION_REQUIRED
Support a current transaction, create a new one if none exists. |
static int |
PROPAGATION_REQUIRES_NEW
Create a new transaction, suspend the current transaction if one exists. |
static int |
PROPAGATION_SUPPORTS
Support a current transaction, execute non-transactionally if none exists. |
static int |
TIMEOUT_DEFAULT
Use the default timeout of the underlying transaction system, or none if timeouts are not supported. |
Method Summary | |
---|---|
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. |
boolean |
isReadOnly()
Return whether to optimize as read-only transaction. |
Field Detail |
---|
static final String PROPAGATION_CONSTANT_PREFIX
static final String ISOLATION_CONSTANT_PREFIX
static final int PROPAGATION_REQUIRED
This is typically the default setting of a transaction definition.
static final int PROPAGATION_SUPPORTS
static final int PROPAGATION_MANDATORY
static final int PROPAGATION_REQUIRES_NEW
static final int PROPAGATION_NOT_SUPPORTED
static final int PROPAGATION_NEVER
static final int PROPAGATION_NESTED
static final int ISOLATION_DEFAULT
Connection
,
Constant Field Valuesstatic final int ISOLATION_READ_UNCOMMITTED
static final int ISOLATION_READ_COMMITTED
static final int ISOLATION_REPEATABLE_READ
static final int ISOLATION_SERIALIZABLE
static final int TIMEOUT_DEFAULT
Method Detail |
---|
int getPropagationBehavior()
PROPAGATION_REQUIRED
int getIsolationLevel()
Only makes sense in combination with PROPAGATION_REQUIRED or PROPAGATION_REQUIRES_NEW.
Note that a transaction manager that does not support custom isolation levels will throw an exception when given any other level than ISOLATION_DEFAULT.
ISOLATION_DEFAULT
int getTimeout()
Only makes sense in combination with PROPAGATION_REQUIRED or PROPAGATION_REQUIRES_NEW.
Note that a transaction manager that does not support timeouts will throw an exception when given any other timeout than TIMEOUT_DEFAULT.
TIMEOUT_DEFAULT
boolean isReadOnly()
Intended to be used in combination with PROPAGATION_REQUIRED or PROPAGATION_REQUIRES_NEW. Beyond optimizing such actual transactions accordingly, a transaction manager might also pass the read-only flag to transaction synchronizations, even outside an actual transaction.
A transaction manager that cannot interpret the read-only hint will not throw an exception when given readOnly=true.
TransactionSynchronization.beforeCommit(boolean)
String getName()
In case of Spring's declarative transactions, the exposed name will be the fully-qualified class name + "." + method name (by default).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |