(Quick Reference)

discard

目的
Purpose

Discards any changes that have been made to a persistent instance.

使用例
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 the 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.