Quantcast

Hook some config into GORM/Hibernate mappings

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Hook some config into GORM/Hibernate mappings

plalloni
This post has NOT been accepted by the mailing list yet.
I'm currently trying to do something like this:

domain:

class SomeDomain {
  // ... properties
  static mapping = {
    table name: "blabla" + SomeConfig.bla()
  }
}

and in src/groovy:

class SomeConfig {
  static bla() {
    return ConfigurationHolder.getConfig().some.bla.bla.bla
  }
}

While this work well when "some.bla.bla.bla" is set in some config, I can't find a way to abort execution (or report error throwing exception) when that setting is not specified.... apparently ConfigurationHolder.getConfig().some.bla.bla.bla returns some string...

Any pointer on how to do this reliably?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Hook some config into GORM/Hibernate mappings

plalloni
plalloni wrote
I'm currently trying to do something like this:

domain:

class SomeDomain {
  // ... properties
  static mapping = {
    table name: "blabla" + SomeConfig.bla()
  }
}

and in src/groovy:

class SomeConfig {
  static bla() {
    return ConfigurationHolder.getConfig().some.bla.bla.bla
  }
}

While this work well when "some.bla.bla.bla" is set in some config, I can't find a way to abort execution (or report error throwing exception) when that setting is not specified.... apparently ConfigurationHolder.getConfig().some.bla.bla.bla returns some string...

Any pointer on how to do this reliably?
Just for the record, the string returned sometimes is "[:]" and sometimes is "{}", but I'm not even able, somehow, to check for those values.
Loading...