I have a tRNA class which may or may not have an associated grRNA, but will be associated to cRNA.
So I can have this relationship :
tRNA -> grRNA -> cRNA
Or this relationship (in this case we don’t have grRNA data) :
tRNA -> cRNA
What is the best way to implement this relationship (we may not have grRNA sometimes) via Grails/Gorm ?
Best domain class design ?
You could have grRNA and cRNA be subclasses of a parent, with tRNA having an association with the parent, and grRN associating with cRNA.
In your database tables you would need a
classcolumn to define the class (discriminatorin the GORM object).Edit:
Something like:
Technically I believe that if you use ‘class’ as your discriminator column name, and the class names as the values, you do not need the ‘discriminator’ lines.