修改Grails插件的ID生成 [英] Modify Id generation for a Grails Plugin
问题描述
我为Grails使用插件 - Amazon S3插件 - 并且由插件提供的域对象不指定Id生成器。我使用的是Postgresql,并要求id生成器是身份证明。
我可以将插件复制到我的插件目录中,并且混淆了提供的域对象,但听起来没有声音像一个干净的方法。我可以在运行时添加正确的id代?或者也许有更好的方法。
如果您使用1.2,您可以为所有GORM类提供默认映射,包括发电机。
grails.gorm.default.mapping = {
id generator:'sequence'
}
更多信息见 1.2发行说明。
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.
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.
这篇关于修改Grails插件的ID生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!