Issue Details (XML | Word | Printable)

Key: GRAILS-2636
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Blocker Blocker
Assignee: Graeme Rocher
Reporter: Stefano Gualdi
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Grails

On bidirectional one-to-one relations references are not correctly updated

Created: 14/Mar/08 05:57 AM   Updated: 14/Mar/08 07:09 AM   Resolved: 14/Mar/08 07:09 AM
Component/s: Persistence
Affects Version/s: 1.0.2
Fix Version/s: 1.0.2

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive onetoone-bug-report-14032008.zip (42 kB)


Testcase included: yes


 Description  « Hide

To reproduce the problem:

grails test-app

on the attached bug report.

The first test will fail and the second will be ok.

Uncomment the setter method in domain class Folder and both tests will pass.

Nabble forum reference: http://www.nabble.com/Strange-behavior-on-bidirectional-one-to-one-relations-to16011577.html



Graeme Rocher added a comment - 14/Mar/08 07:09 AM

You have a bidirectional relationship, in this case you must make sure both sides of the relationship are associated. Changing the code in fillData to do:

folder.specification = spec
		spec.folder = folder <--- added this line

Fixes the problem