Reputation: 11
I have a transactional controller with two actions inside it, edit and update. The update action has a command object parameter. If I call transactionStatus.setRollbackOnly() in the update action, I get MissingPropertyException for transactionStatus. The transactionStatus does not get injected when I have the action parameter. The edit action in the same controller, which does not have any parameters, has access to the transactionStatus property. If I remove the parameter from the problematic action, transactionStatus becomes available. I would like to keep the parameter and be able to rollback when there are errors.
I use grailsVersion=3.2.7. This is how my controller looks:
import com.sample.MyCommand
import grails.transaction.Transactional
@Transactional
class MyController {
def edit() {
//transactionStatus is available here
}
def update(MyCommand command) {
//transactionStatus.setRollbackOnly() causes
//groovy.lang.MissingPropertyException: No such property: transactionStatus for class: com.sample.MyController
}
}
P.S. I wanted to tag the questio with "grails-transactional," but it has not been created yet.
Upvotes: 1
Views: 263