Domain :

import static java.util.UUID.randomUUID

class Example {
    
    String id = randomUUID() as String
    static mapping = {
        id generator:'assigned'
    }
}

In ExampleController, we need to use

example.insert(flush:true,failOnError: true)

instead of

example.save(flush:true,failOnError: true)
Advertisements