« Return to Thread: Strange behavior on bidirectional one-to-one relations

Re: Strange behavior on bidirectional one-to-one relations

by Graeme Rocher-2 :: Rate this Message:

Reply to Author | View in Thread

Raise an issue and attach an example app, this doesn't seem correct

Cheers

On Fri, Mar 14, 2008 at 10:11 AM, stefano gualdi
<stefano.gualdi@...> wrote:

>
>  Hi Robert,
>
>  thanks for your answer.
>
>  Yes, but what if you need to set the field in a second time?
>
>  Imagine to have this case:
>
>  def folder = new Folder(name:'MainFolder', startSpecification: spec1,
>  endSpecification: null)
>
>  endSpecification will be set after some time because is not available at the
>  moment.
>
>  Later you can do:
>
>  def spec = new FolderSpec(details:'dummy1')
>  def folder = Folder.get(someid)
>  folder.endSpecification = spec
>  folder.save(flush:true)
>
>  that, without the explicit setter, will non work (at least in my case).
>
>  Please can you send me a reference for the documentation you are talking
>  about?
>
>  I'm sure I'm missing something but I can't figure out what!!!!
>
>  Thanks
>
>  stefano
>
>
>
>  Robert B wrote:
>  >
>  >
>  >
>  > stefano gualdi wrote:
>  >>
>  >> If i create a new Folder object with this code:
>  >>
>  >> def spec = new FolderSpec(details:'dummy')
>  >> def folder = new Folder(name:'MainFolder')
>  >> folder.specification = spec
>  >> folder.save(flush:true)
>  >>
>  >> the reference 'folder' on FolderSpec remains null. While, using this:
>  >>
>  >> def spec = new FolderSpec(details:'dummy')
>  >> def folder = new Folder(name:'MainFolder', specification: spec)
>  >> folder.save(flush:true)
>  >>
>  >> everything works as expected.
>  >>
>  >>
>  >
>  > I thought that according to the documentation, you're supposed to create
>  > the objects as follows, to get the cascading behavior:
>  >
>  > def folder = new Folder(specification:new FolderSpec(details:'dummy'))
>  > folder.save(flush:true)
>  >
>  > --Rob
>  >
>
>  --
>  View this message in context: http://www.nabble.com/Strange-behavior-on-bidirectional-one-to-one-relations-tp16011577p16047721.html
>
>
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>



--
Graeme Rocher
Grails Project Lead
G2One, Inc. Chief Technology Officer
http://www.g2one.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Strange behavior on bidirectional one-to-one relations