Package org.springframework.transaction.event

# Enum Class TransactionPhase

java.lang.Object
java.lang.Enum<TransactionPhase>
org.springframework.transaction.event.TransactionPhase

All Implemented Interfaces:
  `Serializable`, `Comparable<TransactionPhase>`, `Constable`

public enum TransactionPhase extends Enum<TransactionPhase>
The phase in which a transactional event listener applies.

Since:
  4.2
Author:
  Stephane Nicoll, Juergen Hoeller, Sam Brannen
See Also:
  - `TransactionalEventListener.phase()`
  - `TransactionalApplicationListener.getTransactionPhase()`
  - `TransactionalApplicationListener.forPayload(TransactionPhase, Consumer)`

## Nested Class Summary

## Nested classes/interfaces inherited from class java.lang.Enum

`Enum.EnumDesc<E extends Enum<E>>`

## Enum Constant Summary

Enum Constants
Enum Constant
Description
`AFTER_COMMIT`
Handle the event after the commit has completed successfully.
`AFTER_COMPLETION`
Handle the event after the transaction has completed.
`AFTER_ROLLBACK`
Handle the event if the transaction has rolled back.
`BEFORE_COMMIT`
Handle the event before transaction commit.

## Method Summary

Modifier and Type
Method
Description
`static TransactionPhase`
`valueOf(String name)`
Returns the enum constant of this class with the specified name.
`static TransactionPhase[]`
`values()`
Returns an array containing the constants of this enum class, in the order they are declared.

### Methods inherited from class java.lang.Enum

`clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

## Enum Constant Details

### BEFORE_COMMIT

public static final TransactionPhase BEFORE_COMMIT
Handle the event before transaction commit.

See Also:
  - `TransactionSynchronization.beforeCommit(boolean)`

### AFTER_COMMIT

public static final TransactionPhase AFTER_COMMIT
Handle the event after the commit has completed successfully.

Note: This is a specialization of `AFTER_COMPLETION` and therefore executes in the same sequence of events as `AFTER_COMPLETION` (and not in `TransactionSynchronization.afterCommit()`).

Interactions with the underlying transactional resource will not be committed in this phase. See `TransactionSynchronization.afterCompletion(int)` for details.

See Also:
  - `TransactionSynchronization.afterCompletion(int)`
  - `TransactionSynchronization.STATUS_COMMITTED`

### AFTER_ROLLBACK

public static final TransactionPhase AFTER_ROLLBACK
Handle the event if the transaction has rolled back.

Note: This is a specialization of `AFTER_COMPLETION` and therefore executes in the same sequence of events as `AFTER_COMPLETION`.

Interactions with the underlying transactional resource will not be committed in this phase. See `TransactionSynchronization.afterCompletion(int)` for details.

See Also:
  - `TransactionSynchronization.afterCompletion(int)`
  - `TransactionSynchronization.STATUS_ROLLED_BACK`

### AFTER_COMPLETION

public static final TransactionPhase AFTER_COMPLETION
Handle the event after the transaction has completed.

For more fine-grained events, use `AFTER_COMMIT` or `AFTER_ROLLBACK` to intercept transaction commit or rollback, respectively.

Interactions with the underlying transactional resource will not be committed in this phase. See `TransactionSynchronization.afterCompletion(int)` for details.

See Also:
  - `TransactionSynchronization.afterCompletion(int)`

## Method Details

### values

public static TransactionPhase[] values()
Returns an array containing the constants of this enum class, in the order they are declared.

Returns:
  an array containing the constants of this enum class, in the order they are declared

### valueOf

public static TransactionPhase valueOf(String name)
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)

Parameters:
  `name` - the name of the enum constant to be returned.
Returns:
  the enum constant with the specified name
Throws:
  `IllegalArgumentException` - if this enum class has no constant with the specified name
  `NullPointerException` - if the argument is null