简体   繁体   English

Grails:过滤gorm查询

[英]Grails: Filter gorm query

is there a way to filter any gorm query like the Hibernate Filter Plugin ( http://grails.org/plugin/hibernate-filter ) does but on an easier way without a plugin? 有没有办法过滤任何gorm查询,如Hibernate Filter Plugin( http://grails.org/plugin/hibernate-filter ),但在没有插件的情况下更容易?

What I need: On every query concerning a concrete model, gorm should check an enabled-attribute. 我需要的:在每个关于具体模型的查询中,gorm应该检查一个enabled-attribute。 If it's fales gorm should not return it. 如果它是故事,gorm不应该返回它。

Thank you for you help. 谢谢你的帮助。

You can bypass gorm DSL and use hibernate annotation. 你可以绕过gorm DSL并使用hibernate注释。

Declare your class with annotation as explained here 使用注释声明您的类, 如此处所述

and than add all Hibernate Filters Annotation you want as explained here 然后按照此处的说明添加所需的所有Hibernate过滤器注释

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM