|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TransactionDefinition
Classes implementing this interface define transaction properties.
Note that isolation level, timeout, and read-only settings are
applied unless a new transaction is started. As only TransactionDefinition.PROPAGATION_REQUIRED
and TransactionDefinition.PROPAGATION_REQUIRES_NEW
can actually cause a new transaction to be
started, it usually does not make sense to specify those settings in all other cases.
Furthermore, not all transaction managers support those advanced features and
might throw corresponding exceptions when given non-default values.
Field Summary | |
---|---|
static int |
PROPAGATION_MANDATORY
Supports the current transaction, or throws an exception if none exists. |
static int |
PROPAGATION_NEVER
Executes non-transactionally, or throws an exception if a transaction exists. |
static int |
PROPAGATION_NOT_SUPPORTED
Executes non-transactionally, or suspends the current transaction if one exists. |
static int |
PROPAGATION_REQUIRED
Supports the current transaction, or creates a new one if none exists. |
static int |
PROPAGATION_REQUIRES_NEW
Creates a new transaction, or suspends the current transaction if one exists. |
static int |
PROPAGATION_SUPPORTS
Supports the current transaction, or executes non-transactionally if none exists. |
static int |
TIMEOUT_DEFAULT
Uses the default timeout of the underlying transaction system , or none if timeouts are not supported. |
Method Summary | |
---|---|
java.lang.String |
getName()
Retrieves the name of this transaction. |
int |
getPropagationType()
Retrieves the propagation type. |
int |
getTimeout()
Retrieves the transaction timeout. |
void |
setPropagationType(int aType)
Sets the propagation type to use for this template |
void |
setTimeout(int aSeconds)
Sets the transaction timeout. |
Field Detail |
---|
static final int PROPAGATION_REQUIRED
This is typically the default setting of a transaction definition.
static final int PROPAGATION_SUPPORTS
Note that for transaction managers with transaction synchronization,
TransactionDefinition.PROPAGATION_SUPPORTS
is slightly different from no transaction at all.
It defines a transaction scope for which synchronization will apply.
As a consequence, the same resources (JDBC Connection, Hibernate Session, and so forth)
will be shared for the entire specified scope. This depends on
the actual synchronization configuration of the transaction manager.
static final int PROPAGATION_MANDATORY
static final int PROPAGATION_REQUIRES_NEW
Note that actual transaction suspension will not work without modification
on all transaction managers, particularly JtaTransactionManager
,
which requires that javax.transaction.TransactionManager
be
made available it to it (which is server-specific in standard J2EE).
static final int PROPAGATION_NOT_SUPPORTED
Note that actual transaction suspension will not work without modification
on all transaction managers, particularly JtaTransactionManager
,
which requires that javax.transaction.TransactionManager
be
made available it to it (which is server-specific in standard J2EE).
static final int PROPAGATION_NEVER
static final int TIMEOUT_DEFAULT
Method Detail |
---|
void setPropagationType(int aType)
aType
- The propagation type to use.int getPropagationType()
void setTimeout(int aSeconds)
It is only useful in combination with TransactionDefinition.PROPAGATION_REQUIRED
or
TransactionDefinition.PROPAGATION_REQUIRES_NEW
.
Note that a transaction provider that does not support timeouts
will throw an exception when given any timeout other than TransactionDefinition.TIMEOUT_DEFAULT
.
aSeconds
- The numbers of seconds for the transaction timeout.int getTimeout()
TransactionDefinition.TIMEOUT_DEFAULT
.
It is only useful in combination with TransactionDefinition.PROPAGATION_REQUIRED
or
TransactionDefinition.PROPAGATION_REQUIRES_NEW
.
Note that a transaction provider that does not support timeouts
will throw an exception when given any timeout other than TransactionDefinition.TIMEOUT_DEFAULT
.
java.lang.String getName()
null
.
This will be used as the transaction name to be shown in a transaction monitor.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |