Top Description Constructors Methods
org.springframework.transaction.support

public abstract Class TransactionCallbackWithoutResult

extends Object
implements TransactionCallback<Object>
Class Inheritance
All Implemented Interfaces
org.springframework.transaction.support.TransactionCallback
Imports
org.springframework.lang.Nullable, org.springframework.transaction.TransactionStatus

Simple convenience class for TransactionCallback implementation. Allows for implementing a doInTransaction version without result, i.e. without the need for a return statement.
Author
Juergen Hoeller
Since
28.03.2003
See Also
TransactionTemplate

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final Object
doInTransaction(TransactionStatus
associated transaction status
status
)

Implements org.springframework.transaction.support.TransactionCallback.doInTransaction.

Gets called by TransactionTemplate#execute within a transactional context.
protected abstract void
doInTransactionWithoutResult(TransactionStatus
associated transaction status
status
)

Gets called by TransactionTemplate.execute within a transactional context.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

TransactionCallbackWithoutResultback to summary
public TransactionCallbackWithoutResult()

Method Detail

doInTransactionback to summary
public final Object doInTransaction(TransactionStatus status)

Implements org.springframework.transaction.support.TransactionCallback.doInTransaction.

Doc from org.springframework.transaction.support.TransactionCallback.doInTransaction.

Gets called by TransactionTemplate#execute within a transactional context. Does not need to care about transactions itself, although it can retrieve and influence the status of the current transaction via the given status object, e.g. setting rollback-only.

Allows for returning a result object created within the transaction, i.e. a domain object or a collection of domain objects. A RuntimeException thrown by the callback is treated as application exception that enforces a rollback. Any such exception will be propagated to the caller of the template, unless there is a problem rolling back, in which case a TransactionException will be thrown.

Parameters
status:TransactionStatus

associated transaction status

Returns:Object

a result object, or null

Annotations
@Override
@Nullable
doInTransactionWithoutResultback to summary
protected abstract void doInTransactionWithoutResult(TransactionStatus status)

Gets called by TransactionTemplate.execute within a transactional context. Does not need to care about transactions itself, although it can retrieve and influence the status of the current transaction via the given status object, e.g. setting rollback-only.

A RuntimeException thrown by the callback is treated as application exception that enforces a rollback. An exception gets propagated to the caller of the template.

Note when using JTA: JTA transactions only work with transactional JNDI resources, so implementations need to use such resources if they want transaction support.

Parameters
status:TransactionStatus

associated transaction status

See Also
TransactionTemplate#execute