Grails

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

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Won't Fix
  • Affects Version/s: 1.0.2
  • Fix Version/s: 1.0.2
  • Component/s: Persistence
  • Labels:
    None
  • Testcase included:
    yes

Description

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

Activity

Hide
Graeme Rocher added a comment -

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

Show
Graeme Rocher added a comment - 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

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: