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

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -