Search code examples
grailspluginsid-generation

Modify Id generation for a Grails Plugin


I am using a plugin for Grails - the Amazon S3 plugin - and the domain object provided by the plugin doesn't specify the Id Generator. I am using Postgresql and require the id genrator to be identity.

I could copy the plugin in my plugins directory and mess with the domain object provided but that doesn't sound like a clean approach.Could I add the correct id generation at runtime? Or maybe there is a better way.


Solution

  • If you are using 1.2, you could provide a default mapping for all your GORM classes, including generator.

    grails.gorm.default.mapping = {
       id generator:'sequence'
    }
    

    See more in 1.2 release notes.