同样,也是可能的定制某个列到数据库。比如说,你想改变列名例子如下:class Person {
String firstName
static mapping = {
table 'people'
firstName column:'First_Name'
}
}
在这个例子中,你定义了一个column块,此块包含的方法调用匹配每一个属性名称 (in this case firstName).
接下来使用命名的 column, 来指定字段名称的映射.
同样,也是可能的定制某个列到数据库。比如说,你想改变列名例子如下:class Person {
String firstName
static mapping = {
table 'people'
firstName column:'First_Name'
}
}
在这个例子中,你定义了一个column块,此块包含的方法调用匹配每一个属性名称 (in this case firstName).
接下来使用命名的 column, 来指定字段名称的映射.