2
votes

In my domain class User I would like to have boolean flag active. Is there any way to override methods like User.findAll and User.findAllBy... by adding condition active == true?

What I want to achieve is calling User.findAll means find all users where active is true, and calling dynamic method like User.findAllByName('mike') will return all users with name mike and active flag set to true.

My grails version is 3.0.3

1
You might want to look into the Grails hibernate plugin. Here's a helpful blog link that addresses a similar need.Kartikey Joshi
Grails hibernate plugin is not working with grails 3.x.Piotr Chowaniec

1 Answers

3
votes

I've migrated original hibernate-filter plugin to be able to use it with new Grails 3. New version is published at official Grails 3 plugins repository with grails-hibernate-filter name, direct link to plugin here