No difference between nullable:true and nullable:false in Grails 1.3.6?
The following domain model definition ..
class Tes开发者_开发知识库t {
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.
nullable true/false goes in the static constraints
closure, not in the static mapping
. See the constraints section of the Grails documentation.
精彩评论