I'm trying to create a bi-directional many-to-one relationship in Grails with NON-cascading deletes in both directions. My domain looks like:
class Asset {
static hasMany = [ hosts: Host ]
static mapping = {
hosts cascade: 'save-update'
}
}
class Host {
Asset asset
}
This works fine when deleting a Host (the Asset remains), but when I try to delete the Asset, I get an integrity constraint error from the DB. I've tried changing the Host class definition to use a belongsTo, but can't get this to work. Any help would be great! Thanks!
nullable: true
on theasset
property ofHost
? – James Kleeh