(Quick Reference)

nullable

Purpose

Allows a property to be set to null. By default Grails does not allow null values for properties.

Examples

age(nullable:true)

Description

Set to true if the property allows null values. This constraint influences schema generation.

Error Code: className.propertyName.nullable

An empty form field will appear in the request parameters as an empty string, not as null. Keep this in mind when setting domain fields directly from request parameters. Set the blank constraint to false to ensure that such an empty value fails validation.