Package org.springframework.transaction.support

# Interface SmartTransactionObject

All Superinterfaces:
  `Flushable`

All Known Implementing Classes:
  `JtaTransactionObject`

public interface SmartTransactionObject extends Flushable
Interface to be implemented by transaction objects that are able to return an internal rollback-only marker, typically from another transaction that has participated and marked it as rollback-only.

Autodetected by `DefaultTransactionStatus` in order to always return a current rollbackOnly flag even if not resulting from the current TransactionStatus.

Since:
  1.1
Author:
  Juergen Hoeller
See Also:
  - `DefaultTransactionStatus.isGlobalRollbackOnly()`

## Method Summary

Modifier and Type
Method
Description
`default void`
`flush()`
Flush the underlying sessions to the datastore, if applicable: for example, all affected Hibernate/JPA sessions.
`default boolean`
`isRollbackOnly()`
Return whether the transaction is internally marked as rollback-only.

## Method Details

### isRollbackOnly

default boolean isRollbackOnly()
Return whether the transaction is internally marked as rollback-only. Can, for example, check the JTA UserTransaction.

The default implementation returns `false`.

See Also:
  - `UserTransaction.getStatus()`
  - `Status.STATUS_MARKED_ROLLBACK`

### flush

default void flush()
Flush the underlying sessions to the datastore, if applicable: for example, all affected Hibernate/JPA sessions.

The default implementation is empty, considering flush as a no-op.

Specified by:
  `flush` in interface `Flushable`