Quantcast

cascading without belongsTo

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

cascading without belongsTo

Alan Bowsher-2
I have a situation where I can't use belongsTo on the other side of a 1-to-1 relationship.  I tried using the explicit cascade from the ORM DSL, but it doesn't seem to work.

I.e. 
class A {
  B b
 
  static mapping =  {
    b cascade: "all"
  }

}

Shouldn't this force cascading?  

Example:

If I have an a instance, where b should have errors, and I do a.validate(), I get no errors on either object (and yes they are attached, i.e. a.b = b).  

If I do b.validate(), I get the errors.

So it is not cascading.

I am using Grails 2.0.1....

Thanks


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cascading without belongsTo

Graeme Rocher-2
That settings doesn't currently configure cascading validation, just cascading persistence.

-- 
Graeme Rocher

On Wednesday, February 22, 2012 at 6:05 PM, Alan Bowsher wrote:

I have a situation where I can't use belongsTo on the other side of a 1-to-1 relationship.  I tried using the explicit cascade from the ORM DSL, but it doesn't seem to work.

I.e. 
class A {
  B b
 
  static mapping =  {
    b cascade: "all"
  }

}

Shouldn't this force cascading?  

Example:

If I have an a instance, where b should have errors, and I do a.validate(), I get no errors on either object (and yes they are attached, i.e. a.b = b).  

If I do b.validate(), I get the errors.

So it is not cascading.

I am using Grails 2.0.1....

Thanks



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cascading without belongsTo

Alan Bowsher-2
Well... thanks for the answer, but... wouldn't a save with (validate: true) need to cascade the validation?

On Thu, Feb 23, 2012 at 5:06 AM, Graeme Rocher <[hidden email]> wrote:
That settings doesn't currently configure cascading validation, just cascading persistence.

-- 
Graeme Rocher

On Wednesday, February 22, 2012 at 6:05 PM, Alan Bowsher wrote:

I have a situation where I can't use belongsTo on the other side of a 1-to-1 relationship.  I tried using the explicit cascade from the ORM DSL, but it doesn't seem to work.

I.e. 
class A {
  B b
 
  static mapping =  {
    b cascade: "all"
  }

}

Shouldn't this force cascading?  

Example:

If I have an a instance, where b should have errors, and I do a.validate(), I get no errors on either object (and yes they are attached, i.e. a.b = b).  

If I do b.validate(), I get the errors.

So it is not cascading.

I am using Grails 2.0.1....

Thanks




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cascading without belongsTo

Jeff
Sounds like our issues may be related. Here's a post I created yesterday...

http://grails.1312388.n4.nabble.com/Is-belongsTo-broken-in-Grails-2-0-td4411295.html
Loading...