(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

Web requests resulting from form submissions will have blank strings, not null, for properties that have no value. Keep this in mind when working with the nullable constraint since a blank string will validate for both nullable:true and nullable:false. Set the blank constraint to false to ensure that an empty value fails validation.