2

I have a class X that extends AbstractDomain and has a field createdByUser. On AbstractDomain I have:

Class AbstractDomain { 

...
    def beforeInsert() {

       if(null != securityService) {

        User currentUser = securityService.getCurrentUser()

        if(null != currentUser){
            this.createdByUser = currentUser
        }
      }
}

but createdByUser is populated but never saved but if I change the beforeInsert to beforeValidate the field gets saved. What is causing this?

Update:

I'm using the mongodb:3.0.3 plugin.

Alexander Suraphel
  • 10,103
  • 10
  • 55
  • 90

0 Answers0