The Grails Framework 6.0.0

(Quick Reference) ## id ### Purpose Customizes the way the identifier for a domain class is generated ### Examples
    class Book {
        String id
        String title
        static mapping = {
            id generator: 'uuid'
        }
    }
### Description Usage: `id(map)` Arguments: `generator` (optional) - The name of the generator to use. Can be `increment`, `identity`, `sequence`, `seqhilo`, `uuid`, `uuid.hex`, `assigned`, `select`, `foreign`, `sequence-identity`, `enhanced-sequence` or `enhanced-table`. See Hibernate reference documentation for more information.
| `hilo` generator was removed in Hibernate 5. See Hibernate 5 Migration Guide.
`composite` (optional) - Takes a list of property names to use that form the composite identifier `name` (optional) - The property name to use as the identifier `params` (optional) - Any parameters to pass to the defined identity generator `column` (optional) - The column name to map the identifier to. The remaining column definition properties are also available. By default GORM uses the native strategy to generate a database identifier for each entity (typically an auto-incrementing column or a sequence). You can alter this with the `id` method’s `generator` argument:
    static mapping = {
        id generator: 'uuid'
    }
You can also use the method to define a composite identifier:
    static mapping = {
        id composite: ['title', 'author']
    }
or change the name of the property that defines the identifier:
    static mapping = {
        id name: 'title'
    }
You can also alter the column definition:
    static mapping = {
        id column: 'book_id', type: 'integer'
    }
See the section on Custom Database Identity in the user guide for more information. | Quick Reference (hide)