0
votes

When a domain class inherits from a parent domain class in Grails, do static mappings and static constraints also get inherited or must they be restated in children classes?

Does inheritance only work in domain classes or can controllers and services inherit also?

1

1 Answers

3
votes

Controllers and Services can be inherited as well as domain classes. for controllers see the official example of RestfulController Superclass in the doc. To do inheritance on domain classes, there are some thigs, that have to be recognized like the inheritance of the mapping closure. For more information see here. For Services, it could also be reasonable to use mixins as an alternative (see here).