(Quick Reference)

delete

Purpose

Indicates that a persistent instance should be deleted.

Examples

def book = Book.get(1)
book.delete()

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 to true persistent context will be flushed resulting in the instance being deleted immediately. Example:

def book = Book.get(1)
book.delete(flush:true)