Home transactionStatus causing groovy.lang.MissingPropertyException in controller action with command object parameter
Reply: 0

transactionStatus causing groovy.lang.MissingPropertyException in controller action with command object parameter

user1230
1#
user1230 Published in May 22, 2018, 4:34 am

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.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.306605 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO