Plugin for advanced management of transactions in Grails. Possibly a backport of http://jira.grails.org/browse/GRAILS-7093.
transaction-handling extends the programmatic transaction management capabilities of Grails (DomainClass.withTransaction() and DomainClass.withNewTransaction ()), and allows the reconfiguration of the standards used by other types of transaction management: implicit in Services (transactional = true) or declaratively through annotations (@Transactional).
Initially proposed as a simple backport of GRAILS-7093, the plugin has evolved to allow the reconfiguration of important attributes of transactions, such as timeout and rollback rules, for example.
After installing the plugin, a new version of the method withTransaction and the new method withNewTransaction will be added to Grails domain classes. The method withTransaction only creates a new transaction if there is no transaction in progress (propagation behavior = required). On the other hand, the method withNewTransaction will always create a new transaction, regardless of the existence of a previous one (propagation behavior = requires new). Both methods support the redefinition of other characteristics of the transaction, such as isolation level and timeout. For the full list of configurable characteristics, see TransactionDefinition, TransactionAttribute and RuleBasedTransactionAttribute.
It is still possible to redefine the default values of relevant characteristics of the transaction. Among these characteristics, the most prominent are those that make up the rollback rules: They correspond to a set of exceptions (names or classes) for which the automatic rollback of the transaction can happen or not.