def book = Book.get(1)
book.delete()
delete
Purpose
Deletes a persistent instance.
Examples
Description
The delete
method informs the persistence context that a persistent instance should be deleted. Equivalent to the Hibernate delete method.
Calling delete on a transient instance will result in an error
|
Parameters:
-
flush
- If set totrue
the persistent context will be flushed resulting in the instance being deleted immediately. For example:
def book = Book.get(1)
book.delete(flush: true)