(Quick Reference)

discard

Purpose

Discards any changes that have been made during an update.

Examples

def b = Book.get(1)
b.title = "Blah"
b.discard() // changes won't be applied now

Description

The discard method informs the persistence context that an instance should not be saved. The discard method is equivalent to using Hibernate's evict method.

Note that this method will not clean or reset the object with the original values it will just prevent it from being automatically saved by Grails.