foreign keys - Grails Many to one Relationship deletion -
class first { string text second second static constraints = { } } class second { string name static constraints = { } } when delete second class object, got error this:
cannot delete or update parent row: foreign key constraint fails. i want delete instance of second inside first.
you have remove association of second first (aka fk constraint) , able delete second.
first.second = null second.delete() refer removefrom more details when one-many & many-many relations used.
Comments
Post a Comment