Saving a dictionary that has references to other objects as keys results in data loss in the dictionary.
I have created a simplified example to explain my problem: SDActiveRecord subclass: #Test instanceVariableNames: 'as bs' classVariableNames: '' poolDictionaries: '' category: 'Sandbox' Test>>initialize super initialize. self as1: OrderedCollection new. self bs: OrderedCollection new. self as add: (A new title: 1). self as add: (A new title: 2). self as add: (A new title: 3). self bs add: (B new title: 1). self bs add: (B new title: 2). self bs add: (B new title: 3). self as do: [:a | self bs do: [:b | a dict at: b put: 1]]. Object subclass: #A instanceVariableNames: 'title dict' classVariableNames: '' poolDictionaries: '' category: 'Sandbox' A>>initialize self dict: Dictionary new. Object subclass: #B instanceVariableNames: 'title' classVariableNames: '' poolDictionaries: '' category: 'Sandbox' Evaluating Test new and inspecting the result behaves as expected, but after evaluating Test new save, verifying the Test findAll has the expected values (which it does) and closing the image without saving, opening the image and attempting to reload the objects results in each instance of A's dictionary looking like this. dict: a Dictionary(nil->1) it should have said this(and did before closing and opening the image again): dict: a Dictionary(a B->1 a B->1 a B->1) Hopefully I have explained this problem somewhat well, it is difficult for me to find any other way to explain what I am experiencing. Should I not be using the B objects as dictionary keys? Am I using the wrong dictionary? I am lost. Thanks for any help. -- David Zmick [email protected]
