11.2.4 Events from GORM - Reference Documentation
Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith, Lari Hotari
Version: 3.1.4
11.2.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 withgorm:
. 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