开发者

Grails cascade delete?

开发者 https://www.devze.com 2023-03-29 00:42 出处:网络
I\'m going nuts with foreign key constraints here. No matter what I specify for cascading behavior or belongsTo/hasMany, I get a foreign-key constraint error

I'm going nuts with foreign key constraints here. No matter what I specify for cascading behavior or belongsTo/hasMany, I get a foreign-key constraint error

I have this:

class A{
}

class B{
}

class C extends B {
   st开发者_JAVA技巧atic belongsTo = [a: A]
}

I want to run A.list()*.delete()

What do I need to do to get C to cascade delete with A?


Have you added mappings in class A ?

class A{

    static hasMany=[c:C]
    static mappedBy=[c:"cColumn"]
}

As I understand from this, both mappings should be present

0

精彩评论

暂无评论...
验证码 换一张
取 消