@CompileStatic class GrailsTransactionTemplate extends java.lang.Object
Template class that simplifies programmatic transaction demarcation and transaction exception handling.
| Type | Name and description |
|---|---|
java.lang.String |
connectionNameThe named connection whose transaction manager this template runs, or null. |
CustomizableRollbackTransactionAttribute |
transactionAttribute |
| Constructor and description |
|---|
GrailsTransactionTemplate(PlatformTransactionManager transactionManager) |
GrailsTransactionTemplate(PlatformTransactionManager transactionManager, TransactionDefinition transactionDefinition) |
GrailsTransactionTemplate(PlatformTransactionManager transactionManager, TransactionAttribute transactionAttribute) |
GrailsTransactionTemplate(PlatformTransactionManager transactionManager, CustomizableRollbackTransactionAttribute transactionAttribute) |
GrailsTransactionTemplate(PlatformTransactionManager transactionManager, CustomizableRollbackTransactionAttribute transactionAttribute, java.lang.String connectionName)A template for the transaction manager of a named connection; see getConnectionName(). |
| Type Params | Return Type | Name and description |
|---|---|---|
<T> |
T |
execute(Closure<T> action) |
<T> |
T |
executeAndRollback(Closure<T> action) |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
The named connection whose transaction manager this template runs, or null. Given one, the action
routes the unqualified GORM operations of every domain class mapped to that connection to it, as the
connection's own withTransaction does for its class.
A template for the transaction manager of a named connection; see getConnectionName(). A method
annotated @Transactional(connection = 'books') runs through one.
transactionManager - The connection's transaction managertransactionAttribute - The transaction attributeconnectionName - The connection, or null for none