I'm having some problems with the GORM part of Grails. I am using Grails 1.3.4, together with H2.
In the database I have two tables template and report. On the GORM-level I have the two Domain classes Template
and Report
;
class Template { static hasMany = [reports: Report] ... }
and
class Report { static belongsTo = [template: Template] ... }
Default behaviour seems to be that when a Template
is deleted, the deletion will be cascaded so that all Report
s that it has will be deleted as well. On the database level I tried to make the template_id-column in the report-table be a ON DELETE SET NULL foreign key , but that didn't work.
Is there some way to override the cascade delete?