private static class JpaTransactionManager.JpaTransactionDefinition extends DelegatingTransactionDefinition implements ResourceTransactionDefinition
JpaDialect.beginTransaction(EntityManager, org.springframework.transaction.TransactionDefinition)
.Modifier and Type | Field and Description |
---|---|
private boolean |
localResource |
private int |
timeout |
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
Constructor and Description |
---|
JpaTransactionDefinition(TransactionDefinition targetDefinition,
int timeout,
boolean localResource) |
Modifier and Type | Method and Description |
---|---|
int |
getTimeout()
Return the transaction timeout.
|
boolean |
isLocalResource()
Determine whether the transactional resource is ready for local optimizations.
|
equals, getIsolationLevel, getName, getPropagationBehavior, hashCode, isReadOnly, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getIsolationLevel, getName, getPropagationBehavior, isReadOnly
public JpaTransactionDefinition(TransactionDefinition targetDefinition, int timeout, boolean localResource)
public int getTimeout()
TransactionDefinition
Must return a number of seconds, or TransactionDefinition.TIMEOUT_DEFAULT
.
Exclusively designed for use with TransactionDefinition.PROPAGATION_REQUIRED
or
TransactionDefinition.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 TransactionDefinition.TIMEOUT_DEFAULT
.
getTimeout
in interface TransactionDefinition
getTimeout
in class DelegatingTransactionDefinition
public boolean isLocalResource()
ResourceTransactionDefinition
isLocalResource
in interface ResourceTransactionDefinition
true
if the resource is known to be entirely transaction-local,
not affecting any operations outside of the scope of the current transactionTransactionDefinition.isReadOnly()