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

标签 grails gorm grails-domain-class

如何强制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/

相关文章:

grails - 如果在grails中删除了用户,如何在update()中设置当前数据

grails - 插件从 Grails 3.1.11 升级到 3.2.2 失败

java - <%= @something %> 在 Java 属性文件中是什么意思?

grails - Grails 3-某些域类导致空指针异常

database-design - Grails域可以继承吗?

grails - Grails丢弃域对象

json - Grails JSON转换器

java - 如何在服务器端为使用 Grails 和 CXF 发布的 Web 服务启用 MTOM?

grails - 如何一步一步保存 'rooted'域类树?

grails - GORM-将3个查询更改为1个(或至少2个)