(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 doing mass property binding to properties that have been marked with nullable: true. A blank string will validate for nullable:true since the data binder will convert blank strings to null when binding to a constrained property which has been marked with nullable: true.