Abstract domain class and query name inheritance?

I have a question about named query inheritance capabilities. We would like to store some named queries in our abstract domain class like this.

abstract class AbstractDomain { boolean state static namedQueries = { isActive{ eq("state", true) } } } class Person extends AbstractDomain { String name Integer age static namedQueries = { age18 { eq("age", 18) } } } 

When we try to call namedquery in an abstract domain, it fails because the lock lock is overridden.

Person.isActive.age18 failed due to missing isActive attribute.

Is it possible to reuse named queries in the Abstract Domain class?

+4
source share
1 answer

try it

 class Person extends AbstractDomain { String name Integer age static namedQueries = { age18 { eq("age", 18) } } << AbstractDomain.namedQueries } 
+5
source

Source: https://habr.com/ru/post/1439996/


All Articles