如何强制Grails应用程序中的所有实体持久性操作都通过GORM data services发生,而不是直接在我的域类上发生(例如GormEntityApi
和动态查找器中的方法)?
理想情况下,我的域类上根本不提供GormEntityApi
和dynamic finder方法,但我也接受一种解决方案,该方法通过使所有方法都抛出来对方法进行中性化处理。一个UnsupportedOperationException
。
我做了很多互联网搜索,仔细研究了GORM文档,甚至在GORM代码中进行了一些挖掘,但似乎找不到任何信息。由于数据服务提供了与GormEntityApi
和动态查找器相同的所有CRUD功能,因此这似乎是一件很合理的事情。我觉得我一定很想念东西。
最佳答案
How can I enforce that all entity persistence operations in my Grails application happen via a GORM data services
现在没有办法强制执行。
I've done a bunch of internet searches, pored over the GORM documentation, and even dug around in the GORM code a bit, and I can't seem to find any information about this.
我们在框架中没有这样做的支持。
Since data services provide all the same CRUD functionality as GormEntityApi and dynamic finders, this seems like a reasonable thing to want to do. I feel like I must be missing something.
我不认为您缺少任何东西。我们已经考虑过默认情况下不将
GormEntity
特性添加到域类中,但是现在这种情况发生了,我们没有提供将其关闭的机制。
关于grails - 我如何强制使用GORM数据服务而不是GormEntityApi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60916507/