简体   繁体   中英

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?

What I need: On every query concerning a concrete model, gorm should check an enabled-attribute. If it's fales gorm should not return it.

Thank you for you help.

You can bypass gorm DSL and use hibernate annotation.

Declare your class with annotation as explained here

and than add all Hibernate Filters Annotation you want as explained here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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