Top Description Fields Constructors Methods
org.springframework.transaction.support

public abstract Class DelegatingTransactionDefinition

extends Object
implements TransactionDefinition, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.springframework.transaction.TransactionDefinition
Known Direct Subclasses
org.springframework.transaction.interceptor.DelegatingTransactionAttribute
Annotations
@SuppressWarnings:serial
Imports
java.io.Serializable, org.springframework.lang.Nullable, org.springframework.transaction.TransactionDefinition, org.springframework.util.Assert

TransactionDefinition implementation that delegates all calls to a given target TransactionDefinition instance. Abstract because it is meant to be subclassed, with subclasses overriding specific methods that are not supposed to simply delegate to the target instance.
Author
Juergen Hoeller
Since
3.0

Field Summary

Modifier and TypeField and Description
private final TransactionDefinition

Constructor Summary

AccessConstructor and Description
public
DelegatingTransactionDefinition(TransactionDefinition
the target TransactionAttribute to delegate to
targetDefinition
)

Create a DelegatingTransactionAttribute for the given target attribute.

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public int
public String
getName()

Overrides default org.springframework.transaction.TransactionDefinition.getName.

Return the name of this transaction.
public int
public int
getTimeout()

Overrides default org.springframework.transaction.TransactionDefinition.getTimeout.

Return the transaction timeout.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public boolean
isReadOnly()

Overrides default org.springframework.transaction.TransactionDefinition.isReadOnly.

Return whether to optimize as a read-only transaction.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

targetDefinitionback to summary
private final TransactionDefinition targetDefinition

Constructor Detail

DelegatingTransactionDefinitionback to summary
public DelegatingTransactionDefinition(TransactionDefinition targetDefinition)

Create a DelegatingTransactionAttribute for the given target attribute.

Parameters
targetDefinition:TransactionDefinition

the target TransactionAttribute to delegate to

Method Detail

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
other:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getIsolationLevelback to summary
public int getIsolationLevel()

Overrides default org.springframework.transaction.TransactionDefinition.getIsolationLevel.

Doc from org.springframework.transaction.TransactionDefinition.getIsolationLevel.

Return the isolation level.

Must return one of the ISOLATION_XXX constants defined on this interface. Those constants are designed to match the values of the same constants on java.sql.Connection.

Exclusively designed for use with PROPAGATION_REQUIRED or PROPAGATION_REQUIRES_NEW since it only applies to newly started 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 ISOLATION_DEFAULT. Note that a transaction manager that does not support custom isolation levels will throw an exception when given any other level than ISOLATION_DEFAULT.

Returns:int

the isolation level

Annotations
@Override
getNameback to summary
public String getName()

Overrides default org.springframework.transaction.TransactionDefinition.getName.

Doc from org.springframework.transaction.TransactionDefinition.getName.

Return the name of this transaction. Can be null.

This will be used as the transaction name to be shown in a transaction monitor, if applicable.

In case of Spring's declarative transactions, the exposed name will be the fully-qualified class name + "." + method name (by default).

Returns:String

the name of this transaction (null by default}

Annotations
@Override
@Nullable
getPropagationBehaviorback to summary
public int getPropagationBehavior()

Overrides default org.springframework.transaction.TransactionDefinition.getPropagationBehavior.

Doc from org.springframework.transaction.TransactionDefinition.getPropagationBehavior.

Return the propagation behavior.

Must return one of the PROPAGATION_XXX constants defined on this interface.

The default is PROPAGATION_REQUIRED.

Returns:int

the propagation behavior

Annotations
@Override
getTimeoutback to summary
public int getTimeout()

Overrides default org.springframework.transaction.TransactionDefinition.getTimeout.

Doc from org.springframework.transaction.TransactionDefinition.getTimeout.

Return the transaction timeout.

Must return a number of seconds, or TIMEOUT_DEFAULT.

Exclusively designed for use with PROPAGATION_REQUIRED or 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 TIMEOUT_DEFAULT.

The default is TIMEOUT_DEFAULT.

Returns:int

the transaction timeout

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
isReadOnlyback to summary
public boolean isReadOnly()

Overrides default org.springframework.transaction.TransactionDefinition.isReadOnly.

Doc from org.springframework.transaction.TransactionDefinition.isReadOnly.

Return whether to optimize as a read-only transaction.

The read-only flag applies to any transaction context, whether backed by an actual resource transaction (PROPAGATION_REQUIRED/ PROPAGATION_REQUIRES_NEW) or operating non-transactionally at the resource level (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.

Returns:boolean

true if the transaction is to be optimized as read-only (false by default)

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override