id
目的 Purpose
Customizes the way the identifier for a domain class is generated使用例 Examples
class Book {
static mapping = {
id generator: 'hilo',
params: [table: 'hi_value', column: 'next_value', max_lo: 100]
}
}詳細 Description
Usage:
使用方法: id(map)Usage:
id(map)引数: Arguments:
generator(optional) - The name of the generator to use. Can beincrement,identity,sequence,hilo,seqhilo,uuid,guid,native,assigned,select,foreignorsequence-identity. See Hibernate reference documentation for more information.composite(optional) - Takes a list of property names to use that form the composite identifiername(optional) - The property name to use as the identifierparams(optional) - Any parameters to pass to the defined identity generatorcolumn(optional) - The column name to map the identifier to. The remaining column definition properties are also available.
id methods generator argument:static mapping = {
id generator: 'hilo',
params: [table: 'hi_value', column: 'next_value', max_lo: 100]
}static mapping = {
id composite: ['title', 'author']
}static mapping = {
id name: 'title'
}static mapping = {
id column: 'book_id', type: 'integer'
}
