Cascading validation and one-to-many association

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Cascading validation and one-to-many association

_dms_
I have following domain classes:

class A {
    C c
    static hasMany[bs:B]
}

class B {
    static belongsTo = [a:A]
}

class C {
    static belongsTo = [a:A]
}

Each A class instance can have thousands of B class instances.
When I call a.validate(), log shows that all B instances which belongs to 'a' are loaded from DB! In my case it will take a long time.
I've tried this solution: a.validate(deepValidation:false), but no validation occurs on 'c' field in this case.

Is there a way to turn off cascading validation on specific association? Or to validate only new or modified instances?