gorm - How to define custom table mapping by Config.groovy entry in Grails -


i'm developing plugin needs specific index configuration in table mapping.

static mapping = {     myproperty index:'myproperty_idx' } 

is way let plugin users decide if want use or not mapping via config.groovy file?

i believe can read config variables right mapping block.

so line in app consuming plugin's config.groovy

grails.myplugin.useindexforfoo = true

should allow have configurable domain class, such as

class foo {     string mystring      static mapping = {         if (holders.config?.grails?.myplugin?.useindexforfoo)             mystring index: "mystring_idx"     } } 

note have used holders rather injecting grailsapplication bean because mapping config static - not know if optimal or not


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -