class Country {
String id
String name
Boolean active = true
static mapping = {
id generator:'uuid.hex', params:[separator:'-']
}
}
params:[separator:'-']为主键中间使用"-"分隔, 比如生成格式为: 2c9d004d-1b247311-011b-2473734f-0001
当然可以去掉
params:[separator:'-']直接写成
class Country {
String id
String name
Boolean active = true
static mapping = {
id generator:'uuid.hex'
}
}
这样就生成格式为: 2c9d004d1b247311011b2473ebf90003
posted on 2008-07-15 10:05
周锐 阅读(652)
评论(0) 编辑 收藏 所属分类:
Groovy&Grails