Details
-
Bug
-
Resolution: Fixed
-
Medium
-
3.3.0
-
None
Description
The @Transactional annotation is the new Grails-y way of controlling transactional behavior in a service. It uses an AST transformation to essentially wrap public methods (if added to the class) in a GrailsTransactionTemplate. So you get code that looks like this:
public void reject(Invoice invoice) { Reference invoice = new Reference(invoice); CallSite[] arrayOfCallSite = $getCallSiteArray(); GrailsTransactionAttribute $transactionAttribute = (GrailsTransactionAttribute)ScriptBytecodeAdapter.castToType(arrayOfCallSite[9].callConstructor(GrailsTransactionAttribute.class), GrailsTransactionAttribute.class); GrailsTransactionTemplate $transactionTemplate = (GrailsTransactionTemplate)ScriptBytecodeAdapter.castToType(arrayOfCallSite[10].callConstructor(GrailsTransactionTemplate.class, this.transactionManager, $transactionAttribute), GrailsTransactionTemplate.class); $transactionTemplate.execute(new _reject_closure5(this, invoice)); }
The real body of the method is in the reject_closure5, which ends up calling a method named "$tt_reject(...)".
Clover doesn't realize that the code originally under the reject method has essentially been relocated to the $tt__reject method.
Given that @Transactional is a core part of Grails (starting in 2.3, I believe) and the recommended way to control transactions going forward, this is probably something that should be addressed in Clover core.