Usually I’m using One-to-many relationship by this way :
class Study {
static hasMany = [ crfs : Crf ]
String name
...
}
class Crf {
String title
String info
...
}
I can extend this relationship to others domains, Ex :
static hasMany = [ crfs : Crf, crfb : CrfBlood ...]
But in my case I have to link the Study domain to 30 others domains, maybe more…(ex : CrfBlood, CrfMedical, crfFamily, etc…).
What domain model implementation should I use in my case ?
I would like to keep the dynamic finders usability in my project.
Update – model complement :
A Study can have one-to-many Subject.
A Study can have one-to-many Crfs (ex : CrfBlood, CrfMedical, crfFamily, etc…).
A Subject can have one-to-many Visit (ex : a subject can have several Blood testing).
I would like to dynamically assign Crfs to a Study, so how can I use GORM (dynamic finders) without using static hasMany = […] in my domain ?
Maybe, I can implement a service to do the same stuff did by hasMany ?
You can declare all Crf types as subclasses of
Crf, so that you’ll only have one relationship toStudy, but still be able to add the different types.Then you can do: