column

Purpose

Customizes a column definition

Examples

static mapping = {
		currency column: "currency", sqlType: "char", length: 3		
	}

Description

Usage: property_name(map)

Arguments:

By default GORM uses the property name and type to automatically work out a how to map a particular domain property onto the database. For example a String property is typically mapped onto a varchar(255) column. You can customize these using a method that matches the property name and passing the necessary column configuration arguments:

static mapping = {
		currency column: "currency", sqlType: "char", length: 3		
	}

If you are using a Hibernate type that requires multiple column definitions you can use the column method to define each column:

static mapping =  {
     amount type: MonetaryUserType, {
         column name: "value"
         column name: "currency", sqlType: "char", length: 3
     }
}