stevecowling
stevecowling

Reputation: 966

How do you define a hasMany relationship for extended classes?

Given the following (pseudo code) structure:

abstract AbstractClass  (in src/groovy)

And in grails-app/domain

class ExtendedClassA extends AbstractClass

class ExtendedClassB extends AbstractClass

How do I define that ParentClass (in grails-app/domain) hasMany "extended" classes?

class ParentClass
    static hasMany = [things:AbstractClass]

ie. any class that extends the AbstractClass can be included as a "child" of ParentClass

Thanks in advance

Upvotes: 0

Views: 109

Answers (1)

injecteer
injecteer

Reputation: 20699

Create an abstract domain class extending your src/groovy/AbstractClass and there define your hasMany

Upvotes: 1

Related Questions