Search code examples
grailsmetaprogramminggrails-ormamazon-simpledb

Remove simpledb mapWith by meta programming in dev mode


I am using simpleDB GORM with my grails application, though simpledb is great its a huge drag while in development mode, every click takes few seconds resulting in not so rapid development.

From what I understand simpleDB comes into action only if domain class has following two lines in code

String id
static mapWith = "simpledb"

So, my question is, is it possible to remove/hide these two declaration on the fly from domain classes depending on some kind of flag?

Same question asked differently,

Is there a way in Groovy, most probably meta programming, by which I can

  • Remove a variable declaration from a class(Domain class actually)
  • Remove static mapWith declaration from a class(Domain class again)
  • Finally, is there a way to iterate through all my domain class and perform first two operations in bootstrap.

Solution

  • If you remove mapWith = "simpledb" it will be mapped with Hibernate, and it is probably not a very good idea to develop on Hibernate GORM in dev and SimpleDB GORM in prod mode - the biggest problem is that your application would behave very differently because SimpleDB is based on eventually consistency, and it means you would get nasty surprises when in production compared to good old consistent world of relational DB...

    Thank you for using simpledb plugin!

    Roman.