问题描述
我在我的grails应用程序中使用了simpleDB GORM,尽管simpledb在开发模式下非常大,但每次点击都需要几秒钟的时间,导致开发速度不够快。
从我所了解的情况来看,只有当domain class在代码中有两行代码时,simpleDB才会生效
字符串id
静态mapWith =simpledb
我的问题是,是否有可能根据某种标志从域类中删除/隐藏这两个声明?
同样的问题有不同的问题,
有没有一种方法在Groovy中,最有可能的元编程,我可以通过它$ /
- 从类中删除变量声明(实际上是Domain类)
- 从类中删除静态mapWith声明(再次使用Domain类)
- 最后,这是一种遍历我的所有域类并在bootstrap中执行前两个操作的方法。 如果你删除了mapWith =simpledb,它将与Hibernate映射,并且在Hibernate上开发可能不是一个好主意dev中的GORM和prod模式下的SimpleDB GORM - 最大的问题是你的应用程序行为会非常不同,因为SimpleDB基于最终的一致性,并且这意味着在生产中与旧的一致性关系数据库世界相比,你会得到令人讨厌的惊喜。 ..
感谢您使用simpledb插件!
Roman。
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.
解决方案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.
这篇关于通过开发模式下的元编程删除simpledb mapWith的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!