开发者

Grails cascade delete?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜