def b = Book.get(1)
b.title = "Blah"
b.discard() // changes won't be applied now
discard
Purpose
Discards any changes that have been made to a persistent instance.
Examples
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. |