(Quick Reference)

11.3.4 Events from GORM

Version: 3.2.7

11.3.4 Events from GORM

GORM defines a number of useful events that you can listen for.

Each event is translated into a key that starts with gorm:. For example:

import org.grails.datastore.mapping.engine.event.*
...

on("gorm:preInsert") { PreInsertEvent event ->
        println "GOT EVENT $event"
}
These events are triggered asynchronously, and so cannot cancel or manipulate the persistence operations. If you want to do that see the section on Events & Auto Timestamping in the GORM docs