(Quick Reference)



Customizes a column definition


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


Usage: property_name(map)


  • column - The name of the column as a String
  • sqlType (optional) - The underlying SQL type
  • enumType (optional) - The enum type in for type-safe Enum properties. Either ordinal or string.
  • index (optional) - The index name
  • unique (optional) - Whether it is unique or not
  • length (optional) - The length of the column
  • precision (optional) - The precision of the column
  • scale (optional) - The scale of the column

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