Changing ID Generation for Grails Plugin

I am using the plugin for Grails - the Amazon S3 plugin, and the domain object provided by the plugin does not define Id Generator. I use Postgresql and require the identifier to be identical.

I could copy the plugin into my plugins directory and mess with the provided domain object, but this does not seem to be a clean approach. Is it possible to add the correct generation of identifier at runtime? Or maybe there is a better way.

+1
source share
2 answers

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

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

1.2 .

+3

, S3Asset.groovy src/ groovy/. , . , , . * GrailsPlugin.groovy .

, !

+1

All Articles