No difference between nullable:true and nullable:false in Grails 1.3.6?

Posted by knorv on Stack Overflow See other posts from Stack Overflow or by knorv
Published on 2011-01-01T02:43:24Z Indexed on 2011/01/01 2:54 UTC
Read the original article Hit count: 148

Filed under:
|

The following domain model definition ..

class Test {
  String a
  String b

  static mapping = {
    version(false)
    table("test_table")
    a(nullable: false)
    b(nullable: true)
  }
}

.. yields the following MySQL schema ..

CREATE TABLE test_table (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  a varchar(255) NOT NULL,
  b varchar(255) NOT NULL,
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Please note that a and b get identical MySQL column definitions despite the fact a is defined as non-nullable and b is nullable in the GORM mappings.

What am I doing wrong? I'm running Grails 1.3.6.

© Stack Overflow or respective owner

Related posts about grails

Related posts about gorm