我如何强制使用 GORM 数据服务而不是 GormEntityApi

How can I enforce using a GORM data service instead of GormEntityApi

我如何强制我的 Grails 应用程序中的所有实体持久性操作通过 GORM data services 发生,而不是直接在我的域 类 上发生(例如 GormEntityApi 中的方法和动态查找器)?

理想情况下,GormEntityApi 和动态查找器方法在我的域 类 上根本不可用,但我也接受一种解决方案,通过使它们全部抛出来中和这些方法,例如一个 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 特征添加到域 类,但现在这种情况发生了,我们没有提供关闭它的机制。